/* ═══════════════════════════════════════════
   ADD THESE TO THE END OF YOUR main.css
   IF SIDEBAR STYLES ARE MISSING
   ═══════════════════════════════════════════ */

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: #1A1A2E;
    color: #E5E7EB;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 0;
    transform: translateX(260px);
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #14b8a6;
    letter-spacing: 1px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.sidebar-toggle:hover {
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 2px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #D1D5DB;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(13, 115, 119, 0.3);
    color: #14b8a6;
    border-left: 3px solid #14b8a6;
}

.sidebar-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
    color: #6B7280;
}

.sidebar-item.open > .sidebar-link .sidebar-arrow {
    transform: rotate(-90deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.15);
}

.sidebar-sublink {
    display: block;
    padding: 8px 20px 8px 45px;
    color: #9CA3AF;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.sidebar-sublink:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-sublink.active {
    color: #14b8a6;
    font-weight: 600;
}

/* ── Main Wrapper ── */
.main-wrapper {
    margin-right: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s ease;
    background: #F3F4F6;
}

.main-wrapper.sidebar-collapsed {
    margin-right: 0;
}

/* ── Top Header ── */
.top-header {
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1A1A2E;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #4B5563;
}

.header-user-name {
    font-weight: 600;
}

.header-logout {
    text-decoration: none;
    font-size: 18px;
    padding: 4px;
}

.sidebar-toggle-btn {
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: #4B5563;
    display: none;
}

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: 25px;
}

/* ── Footer ── */
.page-footer {
    padding: 15px 25px;
    background: #fff;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9CA3AF;
}

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 0;
    overflow: hidden;
}

/* ── Tables ── */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #0D7377;
    color: #fff;
}

.data-table th {
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #F3F4F6;
    text-align: right;
}

.data-table tbody tr:hover {
    background: #F9FAFB;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: #0D7377;
    color: #fff;
    border-color: #0D7377;
}

.btn-primary:hover {
    background: #0a5c5f;
}

.btn-outline {
    background: transparent;
    color: #0D7377;
    border-color: #D1D5DB;
}

.btn-outline:hover {
    background: #F3F4F6;
    border-color: #0D7377;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1A1A2E;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #0D7377;
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Alerts ── */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 0 25px 15px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #F0FDF4;
    color: #059669;
    border: 1px solid #BBF7D0;
}

.alert-error {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: #FFF7ED;
    color: #D97706;
    border: 1px solid #FED7AA;
}

.alert-info {
    background: #EFF6FF;
    color: #0284C7;
    border: 1px solid #BFDBFE;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: inherit;
    opacity: 0.6;
    padding: 0 5px;
}

.alert-close:hover {
    opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(260px);
        width: 260px;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-right: 0;
    }
    .sidebar-toggle-btn {
        display: block;
    }
}

/* ── Print ── */
@media print {
    .sidebar, .top-header, .page-footer, .btn, .sidebar-toggle-btn {
        display: none !important;
    }
    .main-wrapper {
        margin-right: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
}

/* ── Body Reset ── */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 14px;
    color: #1A1A2E;
    background: #F3F4F6;
    direction: rtl;
    line-height: 1.6;
}

a {
    color: #0D7377;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}