/* ============================================
   GOOGLE FONT IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   MediScanIO - Centralized Stylesheet
   Change variables below to change full theme
   ============================================ */

:root {
    /* Main Colors - Updated to match MediScanIO green */
    --primary:        #4A8C6F;
    --primary-light:  #EBF5F0;
    --primary-dark:   #2D6E52;

    /* Status Colors */
    --success:        #27AE60;
    --success-light:  #E8F8F0;
    --warning:        #F39C12;
    --warning-light:  #FEF9E7;
    --danger:         #E74C3C;
    --danger-light:   #FDEDEC;
    --info:           #2980B9;
    --info-light:     #EBF5FB;

    /* Neutral Colors */
    --bg:             #F4F6FB;
    --card:           #FFFFFF;
    --text:           #2D2D2D;
    --text-muted:     #8A8FA3;
    --border:         #E8ECF4;
    --shadow:         rgba(108, 99, 255, 0.08);

    /* Typography */
    --font:           'Inter', system-ui, -apple-system, sans-serif;
    --font-size:      16px;

    /* Spacing */
    --radius:         16px;
    --radius-sm:      10px;
    --radius-xs:      6px;
    --padding:        20px;
    --gap:            16px;

    /* Navigation */
    --nav-height:     65px;

    /* Max width for mobile first */
    --max-width:      480px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: var(--font-size);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, button, textarea, select {
    font-family: var(--font);
    font-size: var(--font-size);
    outline: none;
    border: none;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1 { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.4rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem;   font-weight: 600; line-height: 1.4; }
p  { line-height: 1.6;  color: var(--text-muted); }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-small   { font-size: 0.85rem; }
.text-bold    { font-weight: 700; }

/* ============================================
   LAYOUT
   ============================================ */
.page-wrapper {
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 20px);
}

.page-header {
    background: var(--card);
    padding: 16px var(--padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
}

.page-header h2 {
    font-size: 1.2rem;
    color: var(--text);
}

.page-content {
    padding: var(--padding);
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--padding);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: var(--padding);
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: var(--gap);
}

.card-sm {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-google {
    background: #fff;
    color: var(--text);
    border: 2px solid var(--border);
    font-weight: 600;
}

.btn-google:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.btn-google img {
    width: 20px;
    height: 20px;
    display: inline;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text);
    background: var(--card);
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.error {
    border-color: var(--danger);
    background: var(--danger-light);
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 5px;
    display: none;
}

.form-error.show {
    display: block;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--nav-height);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px var(--shadow);
    z-index: 200;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
    flex: 1;
}

.nav-item .nav-icon {
    font-size: 1.4rem;
    transition: transform 0.2s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .nav-icon {
    transform: translateY(-2px);
}

.nav-item:hover {
    color: var(--primary);
}

/* Scan button special style */
.nav-item.nav-scan {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 62px;
    height: 62px;
    margin-top: -22px;
    padding: 0;
    box-shadow: 0 6px 20px rgba(74, 140, 111, 0.5);
    flex: none;
    border: 3px solid #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.nav-item.nav-scan .nav-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.nav-item.nav-scan .nav-label {
    font-size: 0.60rem;
    color: rgba(255,255,255,0.95);
    font-weight: 600;
    line-height: 1;
}

.nav-item.nav-scan.active {
    background: var(--primary-dark);
    transform: scale(1.08);
}

/* ============================================
   STATUS BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-normal  { background: var(--success-light); color: var(--success); }
.badge-high    { background: var(--danger-light);  color: var(--danger);  }
.badge-low     { background: var(--info-light);    color: var(--info);    }
.badge-pro     { background: var(--warning-light); color: var(--warning); }

/* ============================================
   PARAMETER RESULT CARD
   ============================================ */
.param-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.param-card.normal { border-left-color: var(--success); }
.param-card.high   { border-left-color: var(--danger);  }
.param-card.low    { border-left-color: var(--info);    }

.param-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px var(--shadow);
}

.param-left {
    flex: 1;
}

.param-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.param-ref {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.param-right {
    text-align: right;
}

.param-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.param-value.normal { color: var(--success); }
.param-value.high   { color: var(--danger);  }
.param-value.low    { color: var(--info);    }

.param-arrow {
    font-size: 1.2rem;
    margin-left: 4px;
}

/* Dietary suggestion expandable */
.param-dietary {
    display: none;
    background: var(--primary-light);
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.6;
    border-left: 3px solid var(--primary);
}

.param-dietary.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--primary-light);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    background: #e0deff;
    border-color: var(--primary-dark);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.upload-area h3 {
    color: var(--primary);
    margin-bottom: 8px;
}

.upload-area p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-wrap {
    background: var(--border);
    border-radius: 20px;
    height: 8px;
    margin: 16px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 20px;
    width: 0%;
    transition: width 0.4s ease;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: var(--gap);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-info    { background: var(--info-light);    color: var(--info);    }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--padding);
    background: linear-gradient(160deg, var(--primary-light) 0%, var(--bg) 60%);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    width: 80px;
    margin: 0 auto 12px;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 1.6rem;
}

.login-logo p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   HOME / DASHBOARD
   ============================================ */
.hero-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius);
    padding: var(--padding);
    color: #fff;
    margin-bottom: var(--gap);
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.hero-card h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.hero-card p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.stat-box {
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.stat-box .stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
}

.stat-box .stat-label {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   PROFILE PAGE
   ============================================ */
.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin: 0 auto 12px;
    display: block;
}

.profile-avatar-wrap {
    text-align: center;
    padding: 24px 0 16px;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
}

.profile-email {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--card);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.menu-item:hover {
    transform: translateX(4px);
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.menu-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.menu-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================
   AD BANNER (free users only)
   ============================================ */
.ad-slot {
    background: var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    margin-bottom: var(--gap);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in  { animation: fadeIn  0.4s ease; }
.slide-up { animation: slideUp 0.4s ease; }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.mt-1 { margin-top: 8px;  }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px;  }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
.rounded { border-radius: var(--radius); }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
