:root {
    --pnu: #00594f;
    --pnu-2: #008878;
    --ink: #17211f;
    --muted: #66736f;
    --line: #dde6e3;
    --bg: #f5f8f7;
    --panel: #fff;
    --danger: #b42318;
    --warning: #b86b00;
    --info: #155eef;
    --ok: #087443;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: PNU, Tahoma, Arial, sans-serif;
    direction: rtl;
}

.fa {
    font-family: FontAwesome !important;
}

a {
    color: inherit;
    text-decoration: none;
}

.ltr { direction: ltr; }
.rtl { direction: rtl; }

/* Layout Grid */
.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: #fff;
    border-left: 1px solid var(--line);
    padding: 16px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    flex: 0 0 auto;
}

.brand img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.brand strong {
    display: block;
    color: var(--pnu);
    font-size: 17px;
}

.brand span {
    color: var(--muted);
    font-size: 12px;
}

.nav {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 4px;
    scrollbar-width: thin;
    scrollbar-color: #b8d8d1 #f4faf8;
}

.nav::-webkit-scrollbar {
    width: 7px;
}

.nav::-webkit-scrollbar-track {
    background: #f4faf8;
    border-radius: 999px;
}

.nav::-webkit-scrollbar-thumb {
    background: #b8d8d1;
    border-radius: 999px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #243936;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    line-height: 1.35;
    min-height: 40px;
}

.nav a i {
    width: 18px;
    text-align: center;
    flex: 0 0 auto;
}

.nav a:hover, .nav a.active {
    background: #e9f5f2;
    color: var(--pnu);
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 72px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
    color: var(--pnu);
}

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

.userbox span {
    font-weight: bold;
}

.badge {
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
}

.content {
    padding: 24px;
    flex: 1;
}

/* Dashboard Metrics & Layouts */
.grid, .cards {
    display: grid;
    gap: 16px;
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric {
    min-height: 116px;
}

.metric .num {
    font-size: 30px;
    color: var(--pnu);
    font-weight: 700;
}

.metric .label {
    color: var(--muted);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title h2 {
    font-size: 18px;
    margin: 0;
    color: var(--pnu);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    align-items: start;
}
.form-grid .full {
    grid-column: span 2;
}
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .full {
        grid-column: span 1;
    }
}

/* Inputs & Form Elements */
label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
    color: #22342f;
}

.form-control, .form-select, input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=password], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    font-family: inherit;
    min-height: 42px;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

/* Buttons */
.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-outline {
    background: #fff;
    color: var(--pnu);
    border: 1px solid var(--pnu);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-soft {
    background: #e9f5f2;
    color: var(--pnu);
}

/* Tables */
table, .table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

th, td, .table th, .table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: right;
    vertical-align: top;
}

th, .table th {
    background: #f1f6f4;
    color: #2d403d;
}

/* Statuses */
.status {
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    display: inline-block;
    border: 1px solid transparent;
}

.status.high, .status.Rejected, .status.Cancelled {
    background: #fee4e2;
    color: #b42318;
    border-color: #fecdca;
}

.status.normal, .status.Approved {
    background: #e9f5f2;
    color: #00594f;
    border-color: #abefc6;
}

.status.low, .status.Pending {
    background: #eef4ff;
    color: #155eef;
    border-color: #d1e9ff;
}

.status.Paid {
    background: #ecfdf3;
    color: #087443;
    border-color: #abefc6;
}

/* Public Route modifier */
.app.no-sidebar {
    grid-template-columns: 1fr;
}

.app.no-sidebar .sidebar,
.app.no-sidebar .topbar {
    display: none !important;
}

/* Admin Dashboard Tabs styling */
.admin-workspace {
    padding: 0;
    overflow: hidden;
}

.dashboard-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line);
    background: #f8fbfa;
    overflow: auto;
}

.dashboard-tab {
    appearance: none;
    border: 0;
    border-left: 1px solid var(--line);
    background: transparent;
    color: #29433f;
    font-family: inherit;
    font-size: 15px;
    padding: 15px 18px;
    min-width: 170px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.dashboard-tab:hover {
    background: #edf7f4;
    color: var(--pnu);
}

.dashboard-tab.active {
    background: #fff;
    color: var(--pnu);
    font-weight: 700;
    box-shadow: inset 0 -3px 0 var(--pnu);
}

.dashboard-tab-pane {
    display: none;
    padding: 18px;
}

.dashboard-tab-pane.active {
    display: block;
}

.admin-split {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
    gap: 16px;
    align-items: start;
}

.subpanel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.compact-form {
    display: grid;
    gap: 10px;
}

.compact-form label {
    font-size: 13px;
    color: var(--muted);
}

.compact-form textarea {
    min-height: 88px;
}

.compact-form .btn {
    justify-content: center;
    margin-top: 4px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.table-wrap .table {
    min-width: 720px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: center;
}

.check-card {
    display: flex;
    align-items: center;
    min-height: 43px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
}

.check-card input {
    margin-left: 8px;
}

.admin-form-grid .btn {
    justify-content: center;
}

.admin-service-cards, .admin-news-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-service-card, .admin-news-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 12px;
}

.admin-service-head, .admin-news-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.admin-service-head strong, .admin-news-title strong {
    display: block;
    color: var(--pnu);
    line-height: 1.6;
}

.admin-service-head span:not(.service-chip), .admin-news-id {
    display: block;
    direction: ltr;
    text-align: right;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.service-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #e9f5f2;
    color: var(--pnu);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
}

.admin-service-switches, .admin-news-meta {
    display: grid;
    gap: 8px;
}

.admin-news-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    font-size: 13px;
}

.admin-news-meta div {
    background: #f8fbfa;
    border: 1px solid #eef4f2;
    padding: 6px;
    border-radius: 6px;
}

.admin-news-meta span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.admin-news-meta strong {
    display: block;
    color: var(--ink);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fbfdfc;
}

.switch-row strong {
    display: block;
    color: #203532;
    font-size: 14px;
}

.switch-row span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
    line-height: 1.6;
}

.switch-toggle {
    position: relative;
    display: inline-block;
    width: 58px;
    height: 32px;
    vertical-align: middle;
    flex: 0 0 auto;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d7e1de;
    border: 1px solid #c4d1cd;
    border-radius: 999px;
    transition: .18s ease;
}

.switch-slider:before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    right: 4px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,.22);
    transition: .18s ease;
}

.switch-toggle input:checked + .switch-slider {
    background: var(--pnu);
    border-color: var(--pnu);
}

.switch-toggle input:checked + .switch-slider:before {
    transform: translateX(-26px);
}

/* Email settings page */
.email-policy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.email-policy-card {
    border: 1px solid #dde6e3;
    background: #fbfdfc;
    border-radius: 8px;
    padding: 16px;
}

.email-policy-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--pnu);
}

.email-policy-card p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.8;
}

.email-policy-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 700;
}

.status-ok { background: #e9f7ef; color: #17683b; }
.status-warn { background: #fff1dc; color: #9a5b00; }
.status-info { background: #eaf3ff; color: #1e5c92; }

/* Responsive adjustments */
@media (max-width: 1100px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; max-height: none; }
    .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow: visible; padding-left: 0; }
    .nav a { margin-bottom: 0; justify-content: center; text-align: center; }
    .grid.cols-4, .grid.cols-3, .admin-split, .admin-service-cards, .admin-news-cards { grid-template-columns: 1fr; }
    .topbar { position: relative; }
    .admin-form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
    .nav { grid-template-columns: 1fr 1fr; }
    .nav a { justify-content: flex-start; text-align: right; }
    .admin-form-grid, .email-policy-grid { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
}

/* Floating Contact Button */
.floating-contact-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 56px;
    height: 56px;
    background-color: var(--pnu, #00594f);
    color: #ffffff !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0, 89, 79, 0.4);
    cursor: pointer;
    z-index: 99999;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}
.floating-contact-btn:hover {
    transform: scale(1.1) rotate(10deg);
    background-color: var(--pnu-2, #008878);
    box-shadow: 0 6px 20px rgba(0, 89, 79, 0.6);
}
.floating-contact-btn i {
    animation: floatingPulse 2s infinite;
}
@keyframes floatingPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* Contact Section & Grid */
.public-contact-section {
    margin-top: 24px;
    padding: 30px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    animation: fadeIn 0.6s ease-out;
}
.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.contact-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.contact-grid-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fbfa;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid #eef4f2;
}
.contact-icon-circle {
    width: 48px;
    height: 48px;
    background: var(--pnu);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
@media (max-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
    .contact-grid.two-cols {
        grid-template-columns: 1fr;
    }
}

/* Notification Center Styling */
.filters {
    display: grid;
    gap: 12px;
    align-items: center;
}
.notification-read-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}
.notification-read-state {
    font-size: 13px;
    color: var(--muted);
}
.notification-title {
    font-size: 15px;
    color: var(--ink);
}
.notification-details-link, .notification-service-link {
    font-size: 13px;
    padding: 6px 12px;
}

/* Notification Details page */
.notification-detail-panel {
    max-width: 800px;
    margin: 0 auto;
}
.notification-detail-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.notification-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.notification-detail-body {
    font-size: 15px;
    line-height: 1.8;
    color: var(--ink);
    margin-bottom: 24px;
}
.notification-action-link {
    margin-top: 16px;
}

/* Notification Settings page */
.notification-settings-page {
    max-width: 1000px;
    margin: 0 auto;
}
.notification-settings-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.notification-settings-hero h2 {
    font-size: 20px;
    color: var(--pnu);
    margin: 10px 0 6px;
}
.notification-settings-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.service-chip {
    background: #e9f5f2;
    color: var(--pnu);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-block;
    font-weight: bold;
}
.notification-settings-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}
.notification-settings-search {
    position: relative;
    flex: 1;
}
.notification-settings-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}
.notification-settings-search .form-control {
    padding-right: 36px;
}
.status-pill {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}
.status-pill.status-info {
    background: #eef4ff;
    color: #155eef;
}
.status-pill.status-ok {
    background: #e9f5f2;
    color: var(--ok);
}
.notification-settings-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 768px) {
    .notification-settings-cards {
        grid-template-columns: 1fr;
    }
}
.notification-setting-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}
.notification-setting-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.notification-setting-name strong {
    display: block;
    font-size: 15px;
    color: var(--ink);
}
.notification-setting-name span {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}
.notification-setting-desc {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
    flex: 1;
}
.notification-setting-meta {
    font-size: 13px;
    margin-bottom: 14px;
    padding-top: 10px;
    border-top: 1px dotted var(--line);
}
.notification-setting-meta span {
    color: var(--muted);
    margin-left: 6px;
}
.notification-setting-switches {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.switch-row strong {
    display: block;
    font-size: 13px;
    color: var(--ink);
}
.switch-row span {
    display: block;
    font-size: 11px;
    color: var(--muted);
}
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
}

/* Input Icon Wrapper globally unified styling */
.input-icon-wrapper {
    position: relative;
    width: 100%;
}
.input-icon-wrapper i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
    pointer-events: none;
    transition: color 0.2s ease;
}
.input-icon-wrapper input:focus + i,
.input-icon-wrapper select:focus + i {
    color: var(--pnu);
}

/* RTL styles: icon on the right, padding-right on input */
html[dir="rtl"] .input-icon-wrapper i {
    right: 14px;
    left: auto;
}
html[dir="rtl"] .input-icon-wrapper input, 
html[dir="rtl"] .input-icon-wrapper select {
    padding-right: 40px !important;
    padding-left: 12px !important;
}

/* LTR styles: icon on the left, padding-left on input */
html[dir="ltr"] .input-icon-wrapper i {
    left: 14px;
    right: auto;
}
html[dir="ltr"] .input-icon-wrapper input, 
html[dir="ltr"] .input-icon-wrapper select {
    padding-left: 40px !important;
    padding-right: 12px !important;
}


