:root {
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #fbbf24;
    --success: #10b981;
    --dark-bg: #030712;
    --glass: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #f9fafb;
    --text-gray: #9ca3af;
}

/* Lock Screen */
.lock-screen {
    position: fixed;
    inset: 0;
    background: var(--dark-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-card {
    text-align: center;
    padding: 2.5rem 2rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 340px;
}

.lock-icon { font-size: 3rem; margin-bottom: 1rem; }
.lock-card h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.lock-card > p { color: var(--text-gray); font-size: 0.85rem; margin-bottom: 1.5rem; }

.pin-input {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 8px;
    font-weight: 800;
    margin-bottom: 1rem;
}

.pin-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
}

.pin-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.pin-error {
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

.glass-bg {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(251, 191, 36, 0.1) 0%, transparent 40%);
    z-index: -1;
}

/* Background image handling */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: url('pitstop_premium_bg.png') no-repeat center center fixed;
    background-size: cover;
    opacity: 0.4;
    filter: blur(2px);
    z-index: -2;
}

.mobile-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--text-gray));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Auth Controls */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-active {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 600;
}

.login-btn-premium {
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-gray);
    border: 1px solid var(--glass-border);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.subtitle {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.form-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-gray);
    margin-bottom: 0.6rem;
}

input, select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.85rem;
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.input-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Image Upload Zone */
.image-upload-zone {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.3s;
}

.image-upload-zone:active { border-color: var(--primary); }

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.5rem;
}

.upload-content i { font-size: 2rem; color: var(--primary); }
.upload-content span { font-weight: 600; font-size: 0.9rem; }
.upload-content small { color: var(--text-gray); font-size: 0.7rem; }

#imagePreview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Multi-image Gallery */
.preview-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 0.75rem;
}

.preview-gallery .thumb-wrap {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.preview-gallery .thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-gallery .thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.photo-count {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* Buttons */
.submit-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 1.15rem;
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

.submit-btn:active { transform: translateY(2px); }

/* Status Overlay */
.status-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.status-modal { width: 100%; max-width: 400px; text-align: center; }

/* Success Display */
.success-display { animation: slideUp 0.4s ease-out; }

.success-icon-wrap {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.success-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    text-align: left;
}

#successPreview {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--success);
}

.premium-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #000;
    text-decoration: none;
    padding: 1.15rem;
    border-radius: 16px;
    font-weight: 800;
    margin-bottom: 1rem;
}

.continue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.2);
    padding: 1.15rem;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.continue-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.4);
}

/* History */
.recent-section { margin-top: 2rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.clear-btn { background: transparent; border: none; color: var(--danger); font-size: 0.75rem; font-weight: 600; cursor: pointer; }

.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.history-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.history-info h4 { font-size: 0.9rem; margin-bottom: 2px; }
.history-info p { font-size: 0.7rem; color: var(--text-gray); }

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

/* Condition Toggle */
.condition-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    width: 100%;
}

.toggle-btn {
    flex: 1;
    border: none;
    padding: 0.85rem;
    border-radius: 9px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-gray);
}

.toggle-btn.new-btn.active {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.toggle-btn.used-btn.active {
    background: var(--accent);
    color: #000;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.toggle-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Spinner */
.dual-ring {
    width: 80px;
    height: 80px;
    border: 4px solid var(--primary);
    border-color: var(--primary) transparent var(--primary) transparent;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    margin: 0 auto 1.5rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Footer */
.app-footer { margin-top: 3rem; text-align: center; color: var(--text-gray); font-size: 0.75rem; }
.app-footer a { color: var(--primary); text-decoration: none; font-weight: 700; }
