@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a; /* Deep Gov Navy */
    --primary-hover: #172554;
    --saffron: #ea580c; /* Indian Saffron */
    --green: #15803d; /* Indian Green */
    --secondary: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #475569;
    --success: #15803d;
    --error: #dc2626;
    --bg: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border: #e2e8f0;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #fff3e0 0%, #e2e8f0 50%, #e8f5e9 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 540px;
    padding: 20px;
}

.screen {
    display: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active {
    display: block;
}

.hidden {
    display: none !important;
}

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

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
    border-top: 5px solid var(--primary);
    text-align: center;
}

/* PMGKAY Official Header Style */
.pmgkay-badge {
    display: inline-block;
    background: linear-gradient(90deg, var(--saffron) 0%, var(--primary) 50%, var(--green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border);
}

.input-group {
    text-align: left;
    margin-bottom: 28px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s;
    background-color: var(--secondary);
    color: var(--primary);
}

.input-group input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.primary-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: var(--text-muted);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.secondary-btn {
    width: 100%;
    padding: 16px;
    background-color: transparent;
    color: var(--text-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background-color: var(--secondary);
    border-color: var(--text-muted);
}

.help-text {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

.error-msg {
    margin-top: 20px;
    padding: 14px;
    background-color: #fef2f2;
    color: var(--error);
    border-left: 4px solid var(--error);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

/* Loading */
.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--secondary);
    border-top: 4px solid var(--saffron);
    border-right: 4px solid var(--primary);
    border-bottom: 4px solid var(--green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Details */
.details-grid {
    text-align: left;
    margin-bottom: 24px;
    background: var(--secondary);
    border-radius: 12px;
    padding: 8px 20px;
}
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.detail-item:last-child { border-bottom: none; }
.detail-item .label { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.detail-item .val { font-weight: 700; font-size: 14px; color: var(--primary); }
.highlight { color: var(--saffron) !important; font-size: 16px !important;}

.auto-start-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: rgba(30, 58, 138, 0.05);
    border-radius: 8px;
}
.small-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin: 0;
}
.auto-start-msg p {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Dispensing */
.warning-header p.blink {
    color: var(--saffron);
    font-weight: 700;
    animation: blinker 1s linear infinite;
}
@keyframes blinker { 50% { opacity: 0.5; } }

.weight-display {
    margin: 40px 0;
    position: relative;
}
.large-value {
    font-size: 56px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}
.unit-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.progress-bar-container {
    background-color: var(--secondary);
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-labels {
    text-align: right;
    margin-bottom: 32px;
}
.progress-text { font-size: 14px; font-weight: 700; color: var(--primary); }

.dispensing-details {
    display: flex;
    justify-content: space-between;
    background: var(--secondary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}
.info-row { display: flex; flex-direction: column; text-align: left; }
.info-row .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;}
.info-row .val { font-size: 18px; font-weight: 800; color: var(--text-main); }

.beneficiary-mini { font-size: 13px; color: var(--text-muted); line-height: 1.6; text-align: center; }

/* Completion */
.success-icon {
    width: 70px;
    height: 70px;
    background: rgba(21, 128, 61, 0.1);
    color: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}
.completion-details {
    background: var(--secondary);
    border-radius: 12px;
    padding: 8px 20px;
    margin-bottom: 24px;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); font-size: 14px; }
.detail-row .value { font-weight: 700; font-size: 14px; color: var(--text-main); }
.status-success { color: var(--green) !important; }

.receipt-box {
    border: 2px dashed var(--border);
    background: #fafafa;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 2;
    color: var(--text-muted);
}
.receipt-box strong { color: var(--text-main); }

.thank-you { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 24px; }
