@font-face { font-family: 'Speda'; src: url('fonts/Speda.ttf'); }

:root {
    --side-bg: #1e293b;
    --main-bg: #f1f5f9;
    --primary: #4361ee;
    --text-main: #1e293b;
    --success: #10b981;
    --pending: #f59e0b;
    --replied: #8b5cf6;
    --rejected: #ef4444;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Speda', 'Segoe UI', sans-serif;
    background-color: var(--main-bg);
    margin: 0;
    direction: rtl;
    color: var(--text-main);
}

.dashboard-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--side-bg);
    padding: 30px 20px;
    border-left: 1px solid #e0e5f2;
    position: sticky;
    top: 0;
    height: 100vh;
    color: white;
}

.sidebar-logo { text-align: center; margin-bottom: 40px; }
.sidebar-logo img { width: 70px; margin-bottom: 10px; }
.sidebar-logo h3 { font-size: 18px; color: #cbd5e1; margin: 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: bold;
}

.sidebar-nav a i { margin-left: 12px; font-size: 18px; }
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content { flex: 1; padding: 30px; min-width: 0; }

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

/* Records Specific Styling */
.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-controls {
    display: flex;
    background: #e2e8f0;
    padding: 5px;
    border-radius: 12px;
    gap: 5px;
}

.record-tab {
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Speda';
    font-weight: bold;
    transition: 0.3s;
    color: #64748b;
}

.record-tab.active {
    background: var(--primary);
    color: white;
}

.print-table-btn {
    background: #64748b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Speda';
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar { position: relative; width: 350px; }
.search-bar input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border-radius: 12px;
    border: 1px solid #e0e5f2;
    background: #f8fafc;
    font-family: 'Speda';
}
.search-bar i { position: absolute; right: 15px; top: 14px; color: #a3aed0; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    font-size: 22px;
}

.blue .stat-icon { background: #eef2ff; color: #4361ee; }
.green .stat-icon { background: #f0fdf4; color: #22c55e; }
.green-light .stat-icon { background: #ecfdf5; color: #10b981; }
.orange .stat-icon { background: #fff7ed; color: #f97316; }
.orange-light .stat-icon { background: #fff7ed; color: #f97316; }

.stat-info h2 { margin: 0; font-size: 24px; }
.stat-info p { margin: 0; color: #8a94ad; font-weight: bold; font-size: 13px; }

/* Cards & Forms */
.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.card-header { 
    font-size: 20px; 
    font-weight: bold; 
    margin-bottom: 25px; 
    color: var(--text-main); 
    display: flex;
    align-items: center;
    border-right: 5px solid var(--primary);
    padding-right: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 14px; font-weight: bold; color: #707ebe; }

input, select {
    background: #f8fafc;
    border: 1px solid #e0e5f2;
    padding: 14px;
    border-radius: 12px;
    font-family: 'Speda';
}

.main-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Speda';
    font-size: 16px;
    transition: 0.3s;
}

/* Table Styling */
.table-responsive { overflow-x: auto; width: 100%; border-radius: 15px; }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th { text-align: right; color: #8a94ad; font-size: 14px; padding: 20px 15px; border-bottom: 2px solid #f4f7fe; }
td { padding: 18px 15px; border-bottom: 1px solid #f4f7fe; font-size: 14px; }

.book-badge { background: #e0e7ff; color: var(--primary); padding: 5px 12px; border-radius: 10px; font-weight: bold; }
.status-badge { padding: 6px 14px; border-radius: 30px; font-size: 12px; font-weight: bold; white-space: nowrap; }

.status-success { background: #dcfce7; color: #166534; }
.status-replied { background: #f3e8ff; color: #6b21a8; }
.status-pending { background: #fff7ed; color: #9a3412; }
.status-rejected { background: #fef2f2; color: #ef4444; }

.file-link-btn {
    background: #f1f5f9;
    color: var(--primary);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-family: 'Speda';
    font-weight: bold;
}

.action-btns { display: flex; gap: 8px; }
.action-btns button {
    width: 40px; height: 40px; border-radius: 10px; border: none; cursor: pointer; transition: 0.3s; font-size: 16px;
}
.btn-action { background: #eef2ff; color: var(--primary); }
.btn-edit { background: #fff7ed; color: #f59e0b; }
.btn-delete { background: #fef2f2; color: #ef4444; }

/* Modal Styling */
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.save-modal-btn { background: var(--primary); color: white; border: none; padding: 10px; border-radius: 10px; cursor: pointer; flex: 1; font-family: 'Speda'; }
.close-modal-btn { background: #cbd5e1; color: #1e293b; border: none; padding: 10px; border-radius: 10px; cursor: pointer; flex: 1; font-family: 'Speda'; }

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    .no-print { display: none !important; }
    .sidebar { display: none; }
    .main-content { padding: 0 !important; width: 100%; }
    .card { box-shadow: none; border: none; padding: 0; }
    table { width: 100%; border: 1px solid #000; font-size: 11px; }
    th, td { border: 1px solid #000; padding: 5px; color: black !important; }
    .table-responsive { overflow: visible !important; }
}

.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; padding: 30px; border-radius: 20px; width: 400px; }

/* 📱 Mobile Adjustments */
@media screen and (max-width: 768px) {
    .dashboard-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; padding: 20px; border-left: none; border-bottom: 1px solid #e0e5f2; }
    .sidebar-logo { margin-bottom: 20px; }
    .sidebar-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .sidebar-nav a { margin-bottom: 0; padding: 10px; font-size: 13px; justify-content: center; }
    .main-content { padding: 15px; }
    .top-bar { flex-direction: column; gap: 15px; padding: 20px; }
    .search-bar { width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    input, select, textarea { font-size: 16px !important; }
}