/* Color Palette - Gas And Go Theme */
:root {
    --primary-red: #ED1C24;
    --primary-yellow: #FDB913;
    --primary-black: #000000;
    --text-dark: #1a1a1a;
    --text-medium: #4a4a4a;
    --text-light: #6a6a6a;
    --bg-light: #f8f8f8;
    --bg-cream: #fefefe;
    --accent-orange: #ff8c00;
    --success: #66bb6a;
    --error: #ef5350;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e8e8e8 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    padding: 20px;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}

/* Welcome/Auth Screens */
.brand-logo {
    width: 280px;
    max-width: 90%;
    height: auto;
    display: block;
    margin: 0 auto 20px;
}

.brand-logo-small {
    width: 200px;
    max-width: 80%;
    height: auto;
    display: block;
    margin: 0 auto 15px;
}

.coffee-icon {
    font-size: 80px;
    text-align: center;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.coffee-icon-small {
    font-size: 60px;
    text-align: center;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    text-align: center;
    color: var(--text-dark);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tagline {
    text-align: center;
    color: var(--text-medium);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.back-btn-container {
    margin-bottom: 20px;
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-medium);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.form-message {
    min-height: 20px;
    text-align: center;
    font-size: 0.95rem;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-message.success {
    background: rgba(102, 187, 106, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.form-message.error {
    background: rgba(239, 83, 80, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Form Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"] {
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

/* Input Error State */
input.error {
    border-color: var(--error);
    background-color: #fff5f5;
}

input.error:focus {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.1);
}

/* Field Error Messages */
.field-error {
    display: none;
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 5px;
    font-weight: 500;
}

/* Password Requirements */
.password-requirements {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--text-light);
}

.password-requirements small {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-medium);
    font-size: 0.813rem;
}

.password-requirements span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.req-unchecked {
    color: var(--text-light);
}

.req-checked {
    color: var(--success);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: var(--primary-red);
    color: white;
}

.btn-primary:hover {
    background: #c91820;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn-secondary {
    background: var(--primary-yellow);
    color: var(--primary-black);
}

.btn-secondary:hover:not(:disabled) {
    background: #e5a711;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Dashboard Header */
.header {
    margin-bottom: 30px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info h2 {
    color: var(--text-dark);
    font-size: 1.8rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-profile {
    background: var(--primary-yellow);
    border: none;
    color: var(--primary-black);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-profile:hover {
    background: #e5a711;
    transform: translateY(-2px);
}

.btn-logout {
    background: transparent;
    border: 2px solid #ddd;
    color: var(--text-medium);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--bg-light);
    border-color: var(--text-medium);
}

/* Token Card */
.token-card {
    background: linear-gradient(135deg, var(--primary-red) 0%, #b81419 100%);
    color: white;
    border-radius: 16px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px var(--shadow-strong);
}

.token-icon {
    font-size: 60px;
}

.token-info h3 {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 5px;
}

.token-count {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 5px;
}

.token-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Last Purchase Info */
.last-purchase {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-medium);
    text-align: center;
}

.last-purchase.hidden {
    display: none;
}

.last-purchase strong {
    color: var(--text-dark);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 30px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-medium);
}

.reward-label {
    font-weight: 600;
    color: var(--text-dark);
}

.progress-bar {
    height: 12px;
    background: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--primary-red) 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Action Buttons */
.actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

/* Message Box */
.message-box {
    min-height: 20px;
    text-align: center;
    font-size: 0.95rem;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.message-box.success {
    background: rgba(102, 187, 106, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.message-box.error {
    background: rgba(239, 83, 80, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Profile Screen */
.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.profile-icon {
    font-size: 80px;
    margin-bottom: 15px;
}

.profile-info {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #ddd;
}

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

.info-label {
    font-weight: 600;
    color: var(--text-medium);
}

.info-value {
    color: var(--text-dark);
    font-weight: 500;
}

.history-section {
    margin-top: 30px;
}

.history-section h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: white;
    border: 2px solid var(--bg-light);
    padding: 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #ddd;
    box-shadow: 0 2px 8px var(--shadow);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.history-token {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.history-pin {
    color: var(--text-medium);
    font-size: 0.9rem;
}

.history-date {
    color: var(--text-medium);
    font-size: 0.85rem;
}

.no-history {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-medium);
    font-style: italic;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

/* Coffee Modal */
#coffeeModal {
    z-index: 1000;
}

/* Gas Code Modal */
#gasCodeModal {
    z-index: 1050;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid var(--bg-light);
}

.modal-header h3 {
    color: var(--text-dark);
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-medium);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.modal-body {
    padding: 30px;
}

.modal-body p {
    margin-bottom: 15px;
    color: var(--text-medium);
}

.modal-body input {
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
}

/* PIN Error Alert (inline in modal) */
.pin-error-alert {
    background: rgba(239, 83, 80, 0.1);
    border: 2px solid var(--error);
    color: var(--error);
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    animation: slideDown 0.3s ease;
}

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

.pin-error-alert.hidden {
    display: none;
}

.error-close-btn {
    background: none;
    border: none;
    color: var(--error);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.error-close-btn:hover {
    background: rgba(239, 83, 80, 0.2);
}

/* Gas Code Modal Specific */
.gas-code-body {
    text-align: center;
}

.gas-code-display {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
    letter-spacing: 4px;
    margin: 20px 0;
    border: 3px dashed #ddd;
}

.gas-code-note {
    font-size: 0.9rem;
    color: var(--text-medium);
    margin-bottom: 25px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .token-card {
        padding: 20px;
    }
    
    .token-count {
        font-size: 2.5rem;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-info h2 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .gas-code-display {
        font-size: 1.5rem;
    }
}