:root {
    --primary: #0066cc;
    --primary-dark: #004d99;
    --sidebar-bg: #1a1d21;
    --sidebar-hover: #2d3238;
    --sidebar-active: #0066cc;
    --body-bg: #f0f2f5;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Tajawal', Arial, sans-serif;
    margin: 0;
    background: var(--body-bg);
    color: #333;
}

/* Sidebar */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.logo-area h4 {
    margin: 0;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
    font-size: 15px;
}

.sidebar-nav .nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-item.active {
    background: rgba(0,102,204,0.15);
    color: var(--primary);
    border-right-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-item i {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

/* Main content */
.main-content {
    flex: 1;
    margin-right: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-navbar {
    background: #fff;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-weight: 600;
    color: #2d3436;
}

.content-area {
    padding: 25px;
    flex: 1;
}

/* Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
    border: none;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2d3436;
}

.stat-card .stat-label {
    color: #636e72;
    font-size: 14px;
    margin-top: 2px;
}

/* Quick Action Cards */
.action-card {
    background: #fff;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.2s;
    text-decoration: none;
    color: #333;
    display: block;
    border: 2px solid transparent;
}

.action-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--primary);
}

.action-card .action-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.action-card h5 {
    font-weight: 600;
    margin-bottom: 5px;
}

.action-card p {
    font-size: 13px;
    color: #636e72;
    margin: 0;
}

/* Panel Card */
.panel-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.panel-card .panel-header {
    padding: 18px 22px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-card .panel-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 16px;
}

.panel-card .panel-body {
    padding: 20px 22px;
}

/* Tables */
.table-modern {
    margin: 0;
}

.table-modern thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: #636e72;
    border-bottom: 2px solid #eee;
    padding: 12px;
}

.table-modern tbody td {
    padding: 12px;
    vertical-align: middle;
    font-size: 14px;
}

.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Invoice Preview */
.invoice-preview {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    position: relative;
}

/* Template Cards */
.template-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.template-card:hover,
.template-card.selected {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.template-card .template-preview {
    height: 200px;
    padding: 15px;
    overflow: hidden;
    transform: scale(0.6);
    transform-origin: top right;
}

.template-card .template-info {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.template-card .template-info h6 {
    margin: 0 0 5px;
    font-weight: 600;
}

/* Color picker */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-group input[type="color"] {
    width: 45px;
    height: 35px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
}

/* Form styling */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
    padding: 10px 24px;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0066cc 0%, #004d99 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .login-logo i {
    font-size: 50px;
    color: var(--primary);
}

.login-card .login-logo h3 {
    margin-top: 10px;
    font-weight: 700;
    color: #2d3436;
}

/* Excel Import */
.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 50px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(0,102,204,0.05);
}

.upload-zone i {
    font-size: 48px;
    color: #adb5bd;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar.show + .sidebar-overlay {
        display: block;
    }
    .main-content {
        margin-right: 0;
    }
}

@media print {
    .sidebar, .top-navbar, .no-print {
        display: none !important;
    }
    .main-content {
        margin-right: 0 !important;
    }
    .content-area {
        padding: 0 !important;
    }
    .invoice-preview {
        box-shadow: none !important;
    }
}
