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

:root {
    /* Color Palette - Premium Dark Theme for Admin */
    --bg-dark: #0b0f19;
    --bg-card: rgba(22, 30, 49, 0.7);
    --bg-card-hover: rgba(29, 39, 64, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(124, 58, 237, 0.5);
    
    --primary: #7c3aed; /* Violet */
    --primary-light: #9f67ff;
    --secondary: #db2777; /* Fuchsia */
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    --gradient-glow: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(219, 39, 119, 0.15) 100%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #111827;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Layout Tokens */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Fonts */
    --font-ui: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-doc: 'Inter', sans-serif;
}

/* Light Theme Variables for Policy View (if chosen, or default document print styling) */
.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #7c3aed;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover {
    color: var(--secondary);
}

/* Main Layout for Dashboard */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: rgba(15, 22, 38, 0.95);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-top: -0.2rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item button {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: left;
}

.nav-item button svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.nav-item.active button,
.nav-item button:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active button {
    background: var(--gradient-glow);
    color: var(--text-main);
    border-left: 3px solid var(--primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.nav-item.active button svg {
    stroke: var(--primary-light);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-light);
    border: 2px solid var(--border-color);
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2.5rem;
    max-width: 1400px;
    width: calc(100% - 280px);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-muted);
}

/* Glass Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Grid & Dashboard Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.metric-card:nth-child(2) .metric-icon {
    background: rgba(219, 39, 119, 0.1);
    color: var(--secondary);
}

.metric-info h3 {
    font-size: 1.75rem;
    line-height: 1.2;
}

.metric-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Tabs & Panes */
.tab-pane {
    display: none;
    animation: fadeIn var(--transition-normal) forwards;
}

.tab-pane.active {
    display: block;
}

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

/* Form Styles - Multi-step generator */
.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.wizard-steps {
    display: flex;
    gap: 2rem;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.step-indicator .step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.step-indicator.active {
    color: var(--primary-light);
}

.step-indicator.active .step-number {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.step-indicator.completed {
    color: var(--success);
}

.step-indicator.completed .step-number {
    background: var(--success);
    color: #ffffff;
}

.form-step-content {
    display: none;
}

.form-step-content.active {
    display: block;
    animation: slideIn var(--transition-normal);
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group-full {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.form-control {
    background: rgba(15, 22, 38, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    transition: var(--transition-fast);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-focus);
    background: rgba(15, 22, 38, 0.8);
}

/* Custom Multi-select Options (Checkboxes & Switches) */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.custom-option {
    background: rgba(15, 22, 38, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.custom-option:hover {
    background: rgba(15, 22, 38, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.custom-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    margin-top: 2px;
    flex-shrink: 0;
}

.custom-option input[type="checkbox"]:checked {
    background: var(--gradient-primary);
    border-color: transparent;
}

.custom-option input[type="checkbox"]:checked::after {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    width: 12px;
    height: 12px;
}

.custom-option-info {
    display: flex;
    flex-direction: column;
}

.custom-option-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
}

.custom-option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Wizard Navigation Footer */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

/* Dashboard Table Styles */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

table.policies-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table.policies-table th {
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table.policies-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

table.policies-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-store {
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-date {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Modals & Popups */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #0f1626;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transform: translateY(150%);
    transition: var(--transition-normal);
    z-index: 200;
}

.toast.active {
    transform: translateY(0);
}

.toast-error {
    background: var(--danger);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Empty State Styling */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--border-color);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

/* POLICY VIEWER (policy.html) Specific layout */
.policy-page {
    background-color: #f8fafc;
    color: #1e293b;
    font-family: var(--font-doc);
    line-height: 1.7;
    padding: 0;
    min-height: 100vh;
}

.policy-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 2rem;
}

.policy-navbar-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.policy-navbar-logo {
    font-family: var(--font-heading);
    font-weight: 800;
    color: #0f172a;
    font-size: 1.1rem;
}

.policy-container {
    max-width: 800px;
    margin: 3rem auto;
    background: #ffffff;
    padding: 3rem 4rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
}

.policy-content h1 {
    font-size: 2.25rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
    line-height: 1.25;
}

.policy-meta {
    font-size: 0.9rem;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.policy-content h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

.policy-content h3 {
    font-size: 1.15rem;
    color: #334155;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.policy-content p {
    margin-bottom: 1.25rem;
    color: #334155;
}

.policy-content ul {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.policy-content li {
    margin-bottom: 0.5rem;
    color: #334155;
}

.policy-content strong {
    color: #0f172a;
}

/* Print Styling */
@media print {
    .policy-navbar {
        display: none !important;
    }
    .policy-container {
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
        max-width: 100%;
    }
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
        align-items: center;
    }
    .logo-text, .logo-tag, .sidebar-footer, .nav-item button span {
        display: none;
    }
    .logo-container {
        margin-bottom: 2rem;
    }
    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
        padding: 1.5rem;
    }
    .nav-item button {
        justify-content: center;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group-full {
        grid-column: span 1;
    }
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
    }
    .logo-container {
        margin-bottom: 0;
    }
    .logo-text {
        display: block;
    }
    .nav-menu {
        flex-direction: row;
        margin-left: 1rem;
        flex-grow: 0;
    }
    .nav-item button {
        padding: 0.5rem;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .policy-container {
        padding: 1.5rem;
        margin: 1rem;
    }
}
