/* 1. Base Variables (Light Mode Default) */
:root {
    --bg-main: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
}

/* 2. Dark Mode Variables */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --card-bg: #1e293b;
}

/* 3. Automatic Device Detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-main: #0f172a;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --card-bg: #1e293b;
    }
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

/* Top Navigation */
.top-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo span {
    color: var(--text-muted);
}

/* Main Container */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 24px;
}

.app-header {
    max-width: 600px;
    margin-bottom: 48px;
}

.app-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    margin-bottom: 16px;
}

.app-header p {
    font-size: 1.125rem;
    color: var(--text-muted);
}

.app-header strong {
    color: var(--text-main);
    font-family: monospace;
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Bento Grid Storefront */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

@media (min-width: 768px) {
    .bento-grid button:first-child {
        grid-column: span 2;
    }
}

.bento-card {
    appearance: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.bento-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary, #333);
    opacity: 0;
    transition: opacity 0.2s;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--text-muted);
}

.bento-card:hover::before {
    opacity: 1;
}

.bento-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.brand-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-main);
    padding: 10px;
    transition: all 0.3s ease;
}

.brand-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    fill: currentColor;
}

.bento-card:hover .brand-icon {
    transform: scale(1.1) rotate(-5deg);
    background: var(--border-color);
}

.card-text h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.card-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.card-price {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.card-price .currency {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card-price .amount {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Modals / Dialogs */
.modern-dialog {
    margin: auto;
    border: none;
    border-radius: 24px;
    background: var(--card-bg);
    width: min(90vw, 440px);
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    color: var(--text-main);
}

.modern-dialog::backdrop {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dialog-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

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

/* Instructions inside Modal */
.payment-instruction {
    background: var(--bg-main);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.number-plate {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: center;
    font-family: 'Space Grotesk', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    border-radius: 8px;
    margin: 8px 0 16px;
    letter-spacing: 0.05em;
}

/* Forms */
.app-form {
    display: grid;
    gap: 16px;
}

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

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

.form-group input, .form-group textarea, .form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--bg-main);
    color: var(--text-main);
    width: 100%;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.mono-input {
    font-family: monospace !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.primary-btn {
    background: var(--text-main);
    color: var(--card-bg);
}

.primary-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.checkout-btn {
    margin-top: 8px;
    padding: 16px;
    font-size: 1.05rem;
}

.secondary-btn {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

.full-width { width: 100%; margin-top: 24px; }

/* Status Views in Modal */
.dialog-desc { color: var(--text-muted); margin-bottom: 24px; }

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

.badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.pending { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge.approved { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.badge.error { background: #fee2e2; color: #ef4444; border: 1px solid #fecaca; }
.badge.success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

.receipt-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.receipt-details span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px;}
.receipt-details strong { font-size: 1rem; color: var(--text-main); }

.invite-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
    margin-top: 12px;
}

.invite-btn:hover { background: var(--border-color); }

/* --- Modernized Credentials Box --- */
.credential-box {
    margin-top: 24px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
}

.credential-box .eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.secure-text {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #1e293b;
    padding: 20px;
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.05rem;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.6;
    letter-spacing: 0.03em;
}

.secure-text.pending {
    background: var(--bg-main);
    border: 2px dashed var(--border-color);
    color: var(--text-muted);
    box-shadow: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-align: center;
    font-size: 0.95rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.toast {
    padding: 16px 24px;
    background: var(--text-main);
    color: var(--card-bg);
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out forwards;
}

.toast.error { background: var(--error); color: white; }
.toast.success { background: var(--success); color: white; }

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

/* --- Admin Table --- */
.admin-table-container { 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.02); 
    overflow: hidden; 
}

.table-header { 
    padding: 24px 32px; 
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.table-scroll { 
    overflow-x: auto; 
}

.requests-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
    background: var(--card-bg);
}

.requests-table th, .requests-table td {
    padding: 20px 32px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.requests-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--bg-main);
    border-bottom: 2px solid var(--border-color);
}

.requests-table tbody tr {
    transition: background-color 0.2s ease;
}

.requests-table tbody tr:hover {
    background-color: var(--bg-main);
}

.admin-actions { display: flex; flex-direction: column; gap: 10px; }

.delivery-form select, .delivery-form textarea {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.delivery-form select:focus, .delivery-form textarea:focus {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.approve-button, .delete-button {
    min-height: 40px;
    padding: 0 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
}

.approve-button { background: var(--text-main); color: var(--card-bg); }
.approve-button:hover { opacity: 0.85; transform: translateY(-1px); }

.delete-button { background: #fee2e2; color: #ef4444; }
.delete-button:hover { background: #fecaca; }

/* --- How It Works Section --- */
.step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.step-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 32px;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.03);
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--text-main);
    color: var(--card-bg);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 20px;
}

.step-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.step-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- Feedback Section --- */
.feedback-section {
    background: var(--bg-main);
    border-radius: 24px;
    padding: 48px;
    margin-bottom: 40px;
}

.feedback-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.feedback-text h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.feedback-text p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.feedback-form {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .feedback-container {
        grid-template-columns: 1fr;
    }
    .feedback-section {
        padding: 32px 24px;
    }
}

/* --- Modernized Footer --- */
.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 64px 24px 32px;
    margin-top: 60px;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 1.2fr;
    gap: 48px;
    margin-bottom: 64px;
}

.footer-brand .logo {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 300px;
}

.footer-links-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.footer-column h4, .footer-contact h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
}

.footer-column a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 12px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--text-main);
}

.footer-contact p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(37, 211, 102, 0.2);
}

.whatsapp-link:hover {
    background: #1da851;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(37, 211, 102, 0.3);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 16px;
}

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

.footer-legal a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-legal a:hover {
    color: var(--text-main);
}

@media (max-width: 768px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        justify-content: center;
    }
}

/* --- Legal Modals --- */
.modal-long {
    max-height: 85vh;
    overflow-y: auto;
}

.legal-content {
    padding-right: 8px;
}

.legal-content h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin: 20px 0 8px;
}

.legal-content p, .legal-content ul {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.legal-content ul {
    padding-left: 20px;
}

.legal-content li {
    margin-bottom: 6px;
}

/* Custom Scrollbar for Modals */
.modal-long::-webkit-scrollbar {
    width: 6px;
}
.modal-long::-webkit-scrollbar-track {
    background: transparent;
}
.modal-long::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.modal-long::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}