/* =============================================================================
   Sarmadi - Production CSS
   Consolidated from all templates for maintainability and real-time updates
   ============================================================================= */

/* =============================================================================
   CSS VARIABLES - Theme System
   ============================================================================= */
:root {
    /* Header Layout */
    --header-offset: 72px;

    /* Brand Colors */
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-pressed: #1E40AF;
    --secondary: #64748B;

    /* Backgrounds */
    --bg-shell: #edecec;
    --bg-card: #FFFFFF;
    --bg-dark: #0B1020;

    /* Text Colors */
    --text-title: #111827;
    --text-body: #374151;
    --text-label: #6B7280;
    --text-muted: #9CA3AF;
    --text-white: #FFFFFF;
    --menu-white: #e2e3e6;
    --footer-gray: #818181;


    --border: #cccccc;

    /* Status Colors */
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #0EA5E9;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-hover: 0 18px 45px rgba(15, 23, 42, 0.10);

    /* Radii & Motion */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 999px;
    --transition-fast: 120ms cubic-bezier(0.22, 0.61, 0.36, 1);
    --transition-std: 200ms cubic-bezier(0.22, 0.61, 0.36, 1);

    --logo-filter: none;
    --illustration-filter: none;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-shell: #0F172A;
    --bg-card: #2b3345;
    --bg-dark: #020617;

    --text-title: #F8FAFC;
    --text-body: #fcfcfc;
    --text-label: #d2d4d6;
    --text-muted: #64748B;
    --text-white: #FFFFFF;

    --border: #334155;

    --primary: #60A5FA;
    --primary-dark: #3B82F6;
    --primary-pressed: #2563EB;

    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 18px 45px rgba(0, 0, 0, 0.5);

    --logo-filter: invert(1);
    --illustration-filter: invert(1) hue-rotate(180deg);
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-shell);
    color: var(--text-body);
    line-height: 1.5;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    transition: background-color var(--transition-std), color var(--transition-std);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-title);
    font-weight: 600;
    margin: 0;
}

/* FIXED: Apply CSS variable colors to all text elements */
p,
span,
li,
label {
    color: var(--text-body);
}

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-dark);
}

/* =============================================================================
   LAYOUT COMPONENTS
   ============================================================================= */

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Header (Public Pages) */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-offset);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .header-fixed {
    background: rgba(30, 41, 59, 0.95);
}

/* Mobile Logo Sizing and Header Adjustments */
@media (max-width: 767px) {
    .header-fixed {
        padding: 0 12px;
    }
    
    .header-logo {
        height: 1.8rem !important;
    }
    
    .header-logo-text {
        font-size: 0.875rem !important;
    }
    
    .header-fixed .container-max {
        padding: 0;
    }
    
    .header-fixed .gap-3 {
        gap: 8px !important;
    }
    
    .header-fixed .gap-2 {
        gap: 6px !important;
    }
    
    .header-action-btn {
        font-size: 12px !important;
        padding: 6px 10px !important;
        white-space: nowrap;
    }
    
    .header-fixed .themeToggle {
        padding: 6px !important;
        min-width: 32px;
    }
    
    .header-fixed .themeToggle i {
        font-size: 1.1rem;
    }
    
    #mobileMenuToggle {
        padding: 6px !important;
        min-width: 32px;
    }
    
    #mobileMenuToggle i {
        font-size: 1.3rem;
    }
}

/* Mobile Menu Styles */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-std), visibility var(--transition-std);
    backdrop-filter: blur(4px);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 1999;
    transform: translateX(-100%);
    transition: transform var(--transition-std);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .mobile-menu {
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-content {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-body);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.mobile-nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.mobile-nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

[data-theme="dark"] .mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-nav-link.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    border-left-color: var(--primary);
}

[data-theme="dark"] .mobile-nav-link.active {
    background: rgba(96, 165, 250, 0.15);
}

@media (min-width: 768px) {
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

.container-max {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

.section-padding {
    padding: 80px 0;
}

@media (max-width: 768px) {
    .section-padding {
        padding: 40px 0;
    }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-dark);
    color: var(--text-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform var(--transition-std);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

.sidebar-link {
    color: var(--text-label);
    text-decoration: none;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-link i {
    font-size: 18px;
    width: 20px;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    border-left: 3px solid var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-shell);
    transition: margin-left var(--transition-std);
    overflow-x: hidden;
    width: calc(100% - 260px);
    max-width: calc(100% - 260px);
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
}

.top-bar {
    height: 72px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}


/* Checked state */
#toggle-checkbox:checked+label .toggle-switch {
    background: var(--primary) !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toggle-switch {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#billing-cycle-toggle:checked+label .toggle-switch {
    background: var(--primary) !important;
}


/* =============================================================================
   CARDS & CONTAINERS
   ============================================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-std);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.style-card {
    padding: 24px;
    transition: all 0.2s ease;
}

.style-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .style-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--text-body);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-ghost:hover {
    background: rgba(206, 206, 206, 0.803);
}

.btn-pill {
    border-radius: var(--radius-full);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* =============================================================================
   FORMS & INPUTS
   ============================================================================= */
input,
select,
textarea {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-title);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-fast);
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Select dropdown styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

/* Select options styling */
option {
    background-color: var(--bg-card);
    color: var(--text-body);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

/* Form labels */
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-label);
}

/* Disabled form elements */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-shell);
}

/* =============================================================================
   TABLES
   ============================================================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 1200px) {
    .table-responsive {
        overflow-x: hidden;
    }
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: auto;
}

.table-custom th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-label);
    background: var(--bg-shell);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table-custom td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
    vertical-align: middle;
    word-wrap: break-word;
    overflow: hidden;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tbody tr {
    transition: background-color var(--transition-fast);
}

.table-custom tbody tr:hover {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.02);
}

[data-theme="dark"] .table-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}




/* =============================================================================
   BADGES & STATUS
   ============================================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(22, 163, 74, 0.15);
    color: #16A34A;
}

[data-theme="dark"] .badge-success {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

.badge-danger {
    background: rgba(220, 38, 38, 0.15);
    color: #DC2626;
}

[data-theme="dark"] .badge-danger {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

.badge-warning {
    background: rgba(217, 119, 6, 0.15);
    color: #D97706;
}

[data-theme="dark"] .badge-warning {
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
}

.badge-info {
    background: rgba(14, 165, 233, 0.15);
    color: #0EA5E9;
}

[data-theme="dark"] .badge-info {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
}

/* =============================================================================
   NAVIGATION
   ============================================================================= */
.nav-link {
    color: var(--text-body);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 600;
}

/* =============================================================================
   MESSAGES & ALERTS
   ============================================================================= */
.messages {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    width: 320px;
}

.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-body);
    animation: slideInRight 0.9s ease-out;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: var(--text-title);
}

/* =============================================================================
   CODE & PRE ELEMENTS
   ============================================================================= */
code,
pre {
    font-family: 'Monaco', 'Consolas', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-title);
}

[data-theme="dark"] code,
[data-theme="dark"] pre {
    background: rgba(255, 255, 255, 0.05);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.text-title {
    color: var(--text-title) !important;
}

.text-body {
    color: var(--text-body) !important;
}

.text-label {
    color: var(--text-label) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-white {
    color: var(--text-white) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}


/* =============================================================================
   DARK MODE - HARDCODED COLOR OVERRIDES
   ============================================================================= */
/* These rules override hardcoded colors in templates to ensure visibility in dark mode */


/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-std);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding: 0 16px;
    }

    .container-max {
        padding: 0 16px;
    }

    .messages {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
    }
}

.adaptive-illustration {
    transition: filter var(--transition-std);
    filter: var(--illustration-filter);
}


@font-face {
    font-family: 'aga-mashq-v2';
    src: url("../fonts/aga-mashq-v2.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}


@font-face {
    font-family: 'AGA-Mashq-Bold';
    src: url("../fonts/AGA-Mashq-Bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}