/**
 * HelsaCure - Main Stylesheet
 * Modern, clean design with medical aesthetics
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* CSS Variables */
:root {
    --primary: #00A67E;
    --primary-dark: #008865;
    --primary-light: #E6F7F3;
    --secondary: #2D3748;
    --accent: #FF6B6B;
    --warning: #F59E0B;
    --danger: #EF4444;
    --success: #10B981;
    --info: #3B82F6;
    
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --bg-tertiary: #EDF2F7;
    
    --border-light: #E2E8F0;
    --border-medium: #CBD5E0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.delivery-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
}

.contact-links {
    display: flex;
    gap: 12px;
}

.contact-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all var(--transition-base);
    font-size: 1.25rem;
}

.contact-btn.whatsapp {
    background: #25D366;
    color: white;
}

.contact-btn.phone {
    background: var(--info);
    color: white;
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Main Content */
.main {
    padding: 60px 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Section */
.search-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 18px 24px 18px 56px;
    font-size: 1.125rem;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-lg);
    outline: none;
    transition: all var(--transition-base);
    font-family: 'Inter', sans-serif;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
    pointer-events: none;
}

/* Suggestions Dropdown */
.suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 50;
    border: 1px solid var(--border-light);
}

.suggestions.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-info {
    flex: 1;
}

.suggestion-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.suggestion-strength {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.suggestion-price {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.125rem;
}

.suggestion-rx {
    background: var(--warning);
    color: white;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 8px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

/* Selected Items */
.selected-items-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
    display: none;
}

.selected-items-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.section-title {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.selected-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.selected-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.selected-item:hover {
    box-shadow: var(--shadow-md);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.item-strength {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.item-rx-badge {
    background: var(--warning);
    color: white;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
    font-weight: 600;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.qty-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.item-price {
    min-width: 100px;
    text-align: right;
}

.unit-price {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.line-total {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.125rem;
}

.remove-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-size: 1.25rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-base);
}

.remove-btn:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.total-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

.total-label {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.total-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Prescription Section - Always Visible */
.prescription-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
    display: block !important; /* Force always visible */
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-top: 4px;
}

.prescription-alert-inline {
    background: linear-gradient(135deg, rgba(0, 166, 126, 0.1), rgba(0, 166, 126, 0.05));
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.alert-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.alert-icon-small {
    font-size: 2rem;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
}

.alert-text strong {
    display: block;
    color: var(--primary-dark);
    font-size: 1.0625rem;
    margin-bottom: 4px;
}

.alert-text p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
}

.rx-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 2px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.warning-icon {
    font-size: 1.5rem;
}

/* Prescription Alert - Legacy (keep for compatibility) */
.prescription-alert {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border: 2px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 40px;
    display: none;
}

.prescription-alert.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.alert-icon {
    width: 40px;
    height: 40px;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.alert-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--warning);
}

.alert-message {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-area {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-primary);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

#prescriptionFile {
    display: none;
}

.file-preview {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    display: none;
}

.file-preview.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.remove-file-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Delivery Form */
.delivery-form {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
    display: none;
}

.delivery-form.active {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    padding: 14px 16px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-base);
    background: var(--bg-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Submit Button */
.submit-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    display: none;
}

.submit-section.active {
    display: block;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    padding: 18px 48px;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    font-family: 'Outfit', sans-serif;
    min-width: 200px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn.loading {
    position: relative;
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.footer {
    background: var(--secondary);
    color: rgba(255, 255, 255, 0.8);
    padding: 40px 0;
    margin-top: 80px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: white;
}

.footer-copyright {
    font-size: 0.875rem;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .search-section,
    .selected-items-section,
    .delivery-form,
    .submit-section {
        padding: 24px;
        border-radius: var(--radius-lg);
    }
    
    .header-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .selected-item {
        flex-wrap: wrap;
    }
    
    .item-info {
        flex-basis: 100%;
    }
    
    .total-section {
        flex-direction: column;
        align-items: flex-end;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .main {
        padding: 40px 0;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .search-section,
    .selected-items-section,
    .delivery-form,
    .submit-section {
        padding: 20px;
    }
    
    .submit-btn {
        width: 100%;
    }
}
