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

:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-light: #ccfbf1;
    --secondary: #0284c7;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --danger: #dc2626;
    --success: #16a34a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #1e293b;
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.35rem;
    color: #2dd4bf;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary);
    color: #ffffff;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.topbar {
    background: var(--bg-card);
    padding: 16px 28px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switch a {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    background: #f8fafc;
}

.lang-switch a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.container {
    padding: 28px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    padding: 22px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border-inline-start: 5px solid var(--primary);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}

.card-header {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--primary-dark);
}

/* Framed Patient Box (Items 1 to 7) */
.patient-frame-box {
    border: 2px solid var(--primary);
    background: #f0fdfa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.patient-frame-title {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #334155;
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #ffffff;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-control[readonly] {
    background: #e2e8f0;
    font-weight: 700;
    color: var(--primary-dark);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    padding: 6px 12px;
    font-size: 0.85rem;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 12px 14px;
    text-align: start;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.92rem;
}

th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
}

tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-dark);
}

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Print Report Styling */
.report-sheet {
    background: #ffffff;
    max-width: 850px;
    margin: 20px auto;
    padding: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.report-patient-box {
    border: 2px solid #0f766e;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 24px;
}

.report-field {
    margin-bottom: 18px;
}

.report-field h4 {
    color: var(--primary-dark);
    font-size: 1rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.report-field p {
    white-space: pre-wrap;
    color: #1e293b;
}

@media print {
    body {
        background: #fff;
    }
    .no-print {
        display: none !important;
    }
    .report-sheet {
        box-shadow: none;
        border: none;
        margin: 0;
        padding: 10px;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
}
