/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;600;700;800&display=swap');

:root {
    /* --- Light Mode --- */
    --bg-color: #e9eef2;
    --primary-color: #4a90e2;
    --primary-light: #e8f0fe;
    --text-color: #2c3e50;
    --text-color-light: #7f8c8d;
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.9);
    --shadow: 0 10px 30px -15px rgba(74, 144, 226, 0.2);
    --input-bg: #f8f9fa;
    --input-border: #dee2e6;
    --danger-color: #e74c3c;
}

/* Theme Colors */
body.theme-green { --primary-color: #2ecc71; --primary-light: #eafaf1; }
body.theme-purple { --primary-color: #9b59b6; --primary-light: #f4ecf7; }
body.theme-orange { --primary-color: #e67e22; --primary-light: #fdf2e9; }
body.theme-red { --primary-color: #e74c3c; --primary-light: #fdedec; }
body.theme-pink { --primary-color: #e84393; --primary-light: #fdebf7; }
body.theme-teal { --primary-color: #00b894; --primary-light: #e0f9f4; }
body.theme-cyan { --primary-color: #00cec9; --primary-light: #e0fbfb; }
body.theme-indigo { --primary-color: #6c5ce7; --primary-light: #f0effd; }
body.theme-yellow { --primary-color: #f1c40f; --primary-light: #fef9e7; }

body.dark-mode {
    /* --- Dark Mode --- */
    --bg-color: #010409;
    --primary-color: #58a6ff;
    --primary-light: rgba(88, 166, 255, 0.1);
    --text-color: #e6edf3;
    --text-color-light: #848d97;
    --card-bg: rgba(22, 27, 34, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.3);
    --input-bg: #0d1117;
    --input-border: #30363d;
    --danger-color: #f85149;
}

/* Dark Mode Theme Colors */
body.dark-mode.theme-green { --primary-color: #2ea043; --primary-light: rgba(46, 204, 113, 0.1); }
body.dark-mode.theme-purple { --primary-color: #a371f7; --primary-light: rgba(155, 89, 182, 0.1); }
body.dark-mode.theme-orange { --primary-color: #d29922; --primary-light: rgba(230, 126, 34, 0.1); }
body.dark-mode.theme-red { --primary-color: #ff6b6b; --primary-light: rgba(231, 76, 60, 0.1); }
body.dark-mode.theme-pink { --primary-color: #fd79a8; --primary-light: rgba(232, 67, 147, 0.1); }
body.dark-mode.theme-teal { --primary-color: #55efc4; --primary-light: rgba(0, 184, 148, 0.1); }
body.dark-mode.theme-cyan { --primary-color: #81ecec; --primary-light: rgba(0, 206, 201, 0.1); }
body.dark-mode.theme-indigo { --primary-color: #a29bfe; --primary-light: rgba(108, 92, 231, 0.1); }
body.dark-mode.theme-yellow { --primary-color: #ffeaa7; --primary-light: rgba(241, 196, 15, 0.1); }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* ئەم کۆدە ڕەنگە شینە نامۆکە لە هەموو شوێنێک لادەبات */
    -webkit-tap-highlight-color: transparent;
    outline: none; /* بۆ دڵنیایی زیاتر کە هیچ چوارچێوەیەکی تر دەرنەکەوێت */

    /* ڕێگری لە دیاریکردن و کۆپیکردنی دەقەکان */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE 10+ */
    user-select: none;         /* Standard */
}

/* دڵنیابوونەوەی تەواو بۆ لابردنی ڕەنگی شین و چوارچێوە لە هەموو دۆخێکدا */
*:focus, *:active, a:active, button:active, input:active, select:active, textarea:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Custom Scrollbar Design */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-mode ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    position: relative;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.dark-mode {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    display: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: 10%;
    left: 10%;
    animation: move-shape 25s infinite alternate;
}

.shape2 {
    width: 300px;
    height: 300px;
    background: #f09;
    bottom: 10%;
    right: 15%;
    animation: move-shape 30s infinite alternate-reverse;
}

@keyframes move-shape {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 50px) scale(1.2); }
}

body.dark-mode .background-shapes {
    display: block;
}

.container {
    width: 100%;
    padding: 8px;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
    animation: fadeInUp 1s ease-out;
    transition: background 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUpSmall {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

body.dark-mode .card {
    background: #2d3748;
    color: #fff;
    border-color: #4a5568;
}

h2 {
    margin-bottom: 1rem;
    /* color: var(--text-color); Removed to allow inheritance from body/card in dark mode */
    font-weight: 700;
    font-size: 1.2rem;
}

.login-icon {
    width: 110px;
    height: 110px;
    margin: 0 auto 20px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: background 0.6s ease, box-shadow 0.6s ease;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-icon img {
    width: 65px;
    height: 65px;
    object-fit: contain;
}

body.dark-mode .login-icon {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 15px;
    text-align: right;
}

label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color-light);
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: #888;
}

.input-wrapper input:focus ~ i.fa-envelope,
.input-wrapper input:focus ~ i.fa-lock:not(.toggle-password-icon) {
    color: var(--primary-color);
}

.input-wrapper .toggle-password-icon {
    right: auto;
    left: 15px;
    cursor: pointer;
    pointer-events: auto;
}

input, select {
    width: 100%;
    padding: 8px 40px 8px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
    transition: 0.3s;
    transition: background-color 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

#password {
    padding-left: 45px;
}

/* Reset padding for select since it doesn't have an icon */
select {
    padding: 8px 15px;
}

input:focus, select:focus {
    border-color: #667eea;
    outline: none;
}

.forgot-password-container {
    text-align: left;
    margin-top: -10px;
    margin-bottom: 15px;
}

.forgot-password-link {
    font-size: 0.85rem;
    color: var(--text-color-light);
    text-decoration: none;
    transition: color 0.3s;
}

.forgot-password-link:hover {
    color: #667eea;
    text-decoration: underline;
}

button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, #11998e, #38ef7d);
    color: #072c29;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(17, 153, 142, 0.5);
}

button[type="submit"]:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(17, 153, 142, 0.4);
}

.links-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--input-border);
}

.link {
    color: var(--text-color-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.link:hover {
    color: var(--text-color);
}

.link.logout-link {
    color: var(--danger-color);
}
.link.logout-link:hover {
    filter: brightness(0.8);
}

/* --- Settings Page Styles --- */
.settings-page-content {
    width: 100%;
    max-width: 100%; /* Full width as requested */
    margin: 0;
    padding: 20px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.settings-content.modern-layout {
    gap: 0; /* Remove gap for new layout */
}

.settings-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.back-btn:hover {
    transform: translateX(5px); /* Move right for RTL back */
}

.settings-section {
    display: flex;
    flex-direction: column;
    animation: fadeInUpSmall 0.6s ease-out backwards;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 75%;
    background: var(--primary-color);
    border-radius: 2px;
}

.settings-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
    overflow: visible; /* Changed from hidden to visible for dropdowns */
    transition: all 0.3s ease;
}

.settings-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px -10px rgba(0,0,0,0.1);
}

.profile-card {
    margin-top: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-color), #2c3e50);
    color: white;
    border: none;
    position: relative; /* For absolute positioning of edit button */
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.profile-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
}

.profile-info p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 500;
}

.profile-edit-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    margin: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.profile-edit-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.setting-row {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background-color 0.2s;
    gap: 18px;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row.clickable {
    cursor: pointer;
}

.setting-row.clickable:hover {
    background-color: var(--primary-light);
}

.setting-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.setting-row:hover .setting-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.setting-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.setting-value {
    color: var(--text-color-light);
    font-size: 0.9rem;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Color Picker Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    padding: 10px;
}

.color-item {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
}

.color-item:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.color-item.active {
    border-color: var(--text-color);
    transform: scale(1.1);
}

.color-item.blue { background-color: #4a90e2; }
.color-item.green { background-color: #2ecc71; }
.color-item.purple { background-color: #9b59b6; }
.color-item.orange { background-color: #e67e22; }
.color-item.red { background-color: #e74c3c; }
.color-item.pink { background-color: #e84393; }
.color-item.teal { background-color: #00b894; }
.color-item.cyan { background-color: #00cec9; }
.color-item.indigo { background-color: #6c5ce7; }
.color-item.yellow { background-color: #f1c40f; }

.current-color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 1px var(--input-border);
}

.arrow-icon {
    font-size: 0.8rem;
    color: var(--text-color-light);
    opacity: 0.7;
}

/* Activity Log Styles */
.activity-log-container {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    color: var(--text-color-light);
    font-size: 0.9rem;
}

.activity-details p {
    margin: 0;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.4;
}

.activity-details .activity-time {
    font-size: 0.75rem;
    color: var(--text-color-light);
}

.activity-details .device-info {
    font-weight: 400;
    color: var(--text-color-light);
    font-size: 0.85em;
    margin-right: 5px;
}

/* Danger Zone Styles */
.danger-title {
    color: var(--danger-color) !important;
    opacity: 1 !important;
}

.danger-title i {
    color: var(--danger-color) !important;
}

.section-description {
    padding: 15px 25px;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color-light);
    border-bottom: 1px solid var(--input-border);
}

.danger-card {
    border-color: var(--danger-color);
}

.danger-card .setting-row:hover {
    background-color: rgba(231, 76, 60, 0.08);
}

.danger-card .setting-icon {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.section-description.danger-desc {
    color: var(--danger-color);
    border-bottom-color: rgba(231, 76, 60, 0.2);
}

/* --- NEW MODERN LAYOUT STYLES --- */
.settings-main-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    padding-top: 25px;
    align-items: flex-start;
}

.settings-nav {
    position: relative; /* For dropdown positioning */
}

.settings-nav-header {
    display: none; /* Hidden on desktop */
    background: var(--card-bg);
    padding: 12px 18px;
    border-radius: 15px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    cursor: pointer;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    transition: all 0.2s ease;
}

.settings-nav-header:hover { background: var(--input-bg); }

.settings-nav ul {
    list-style: none;
    position: sticky;
    top: 95px; /* 70px header + 25px padding */
}

.settings-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color-light);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    position: relative;
}

.settings-nav a:hover {
    background: var(--input-bg);
    color: var(--text-color);
}

.settings-nav a.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

.settings-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}

.settings-nav a .fa-exclamation-triangle {
    color: var(--danger-color);
}

.settings-panels {
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: margin-top 0.3s ease-out;
}

.settings-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: fadeInUpSmall 0.4s ease-out;
}

.settings-panel.active {
    display: flex;
}

.panel-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--input-border);
}

.panel-title.danger-title {
    color: var(--danger-color);
    border-bottom-color: rgba(231, 76, 60, 0.3);
}

/* شاردنەوەی سەردێڕی بەشەکان لەسەر مۆبایل */
@media (max-width: 992px) {
    .panel-title {
        display: none;
    }
}

@media (max-width: 992px) {
    .settings-main-layout {
        grid-template-columns: 1fr;
    }
    .settings-nav-header {
        display: flex;
    }
    .settings-nav ul {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        position: absolute;
        top: calc(100% + 5px);
        right: 0;
        left: 0;
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        border-radius: 15px;
        padding: 8px;
        z-index: 10;
        transition: opacity 0.2s ease-out, visibility 0.2s ease-out, transform 0.2s ease-out;
    }
    .settings-nav.open ul {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* --- New Data Management Styles --- */
.panel-description {
    font-size: 0.9rem;
    color: var(--text-color-light);
    margin-bottom: 20px;
}

.data-management-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.data-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    overflow: visible; /* Changed from hidden to visible for dropdowns */
    display: flex;
    flex-direction: column;
}

.data-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid var(--input-border);
}

.data-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.export-card .data-card-icon {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.import-card .data-card-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.data-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.data-card-body {
    padding: 15px;
    flex-grow: 1;
}

.data-card-body form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

/* Custom Dropdown for Data Cards */
.custom-dropdown.full-width {
    width: 100%;
    display: block;
}

.dropdown-btn.full-width-btn {
    width: 100%;
    justify-content: space-between;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    height: auto;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.dropdown-content.full-width-content {
    width: 100%;
    top: calc(100% + 5px);
    max-height: 200px;
    overflow-y: auto;
}

.data-card-body .data-card-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    margin-top: auto; /* Push to bottom */
}

.export-card .data-card-btn {
    background: #2ecc71;
    color: white;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.import-card .data-card-btn {
    background: #e74c3c;
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.custom-file-upload {
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-color-light);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.custom-file-upload:hover {
    border-color: var(--primary-color);
}

.custom-file-upload i {
    color: var(--primary-color);
}

#import-file-input {
    display: none;
}

.import-warning {
    font-size: 0.8rem;
    text-align: center;
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    padding: 8px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .data-management-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Responsive Design --- */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    .card {
        padding: 1.5rem;
        border-radius: 20px;
    }
    h2 {
        font-size: 1.5rem;
    }
    input, select, button[type="submit"] {
        padding: 0.6rem 40px 0.6rem 15px;
        border-radius: 10px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    button[type="submit"] {
        padding: 12px;
        font-size: 16px;
    }
}

.error-message {
    background-color: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 1px solid rgba(255, 71, 87, 0.3);
    display: none;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal-content {
    max-width: 350px;
    width: 90%;
    transition: all 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-color);
}

/* --- Generic Custom Modal Styles (Shared) --- */
.custom-modal .modal-content {
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.3s ease-out;
}

.custom-modal .modal-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-modal .modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.custom-modal .close-modal {
    position: static;
    color: rgba(255,255,255,0.8);
    font-size: 1.5rem;
}

.custom-modal .close-modal:hover {
    color: white;
}

.custom-modal .modal-body {
    padding: 20px;
}

.custom-modal .modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0,0,0,0.02);
}

.save-btn, .cancel-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align to the start (right in RTL) */
    gap: 15px; /* Add space between icon and text */
    animation: slideDown 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    border-right: 5px solid var(--primary-color);
    font-weight: 600;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

body.dark-mode .toast {
    background: rgba(45, 55, 72, 0.95);
    color: #fff;
}

.toast.success { border-right-color: #2ecc71; }
.toast.error { border-right-color: #e74c3c; }

.toast i { font-size: 1.2rem; }

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOutToast {
    to { opacity: 0; transform: translateY(-20px); }
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background-color: var(--primary-color);
    animation: toastTimer 3.5s linear forwards;
}

.toast.success .toast-progress-bar { background-color: #2ecc71; }
.toast.error .toast-progress-bar { background-color: #e74c3c; }

@keyframes toastTimer {
    from { width: 100%; }
    to { width: 0%; }
}

/* Password Strength Meter */
#password-strength-meter, #settings-password-strength-meter {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    height: 5px;
}

.strength-bar {
    flex: 1;
    height: 100%;
    background-color: #eee; /* Default color */
    border-radius: 5px;
    transition: background-color 0.3s;
}

#password-strength-text, #settings-password-strength-text {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 600;
    height: 1em; /* Reserve space to prevent layout shift */
    transition: color 0.3s;
}

/* Strength level colors */
.strength-bar.weak { background-color: #e74c3c; }
.strength-bar.medium { background-color: #f1c40f; }
.strength-bar.strong { background-color: #2ecc71; }
.strength-bar.very-strong { background-color: #27ae60; }

#password-strength-text.weak, #settings-password-strength-text.weak { color: #e74c3c; }
#password-strength-text.medium, #settings-password-strength-text.medium { color: #f1c40f; }
#password-strength-text.strong, #settings-password-strength-text.strong { color: #2ecc71; }
#password-strength-text.very-strong, #settings-password-strength-text.very-strong { color: #27ae60; }

/* Top Controls (Language & Theme) */
.top-controls {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    pointer-events: none; /* Allows clicking through the empty space */
}

.top-controls > * {
    pointer-events: auto; /* Re-enable clicking on the buttons */
}

.control-group {
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 15px;
    border-radius: 30px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    transition: background 0.6s ease, color 0.6s ease;
}

body.dark-mode .control-group {
    background: rgba(22, 27, 34, 0.8);
    color: #fff;
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    font-weight: 600;
    padding: 5px;
    font-family: inherit;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 140%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    min-width: 130px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-radius: 12px;
    z-index: 101;
    overflow: hidden;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.05);
    animation: fadeInDropdown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top;
}

body.dark-mode .dropdown-content {
    background: rgba(30, 35, 45, 0.95);
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}

.header-lang-dropdown {
    top: 125%;
    min-width: 140px;
}

/* Settings Language Dropdown specific styles */
.settings-lang-dropdown .dropdown-content {
    top: 120%;
    min-width: 140px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: rgba(0,0,0,0.05);
}

body.dark-mode .dropdown-item:hover {
    background: rgba(255,255,255,0.1);
}

/* CSS Flags */
.flag-icon {
    width: 24px;
    height: 16px;
    display: inline-block;
    border-radius: 3px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    position: relative;
}

/* Kurdish Flag */
.flag-ku {
    background: linear-gradient(to bottom, #E3001B 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #228B22 66.66%);
}
.flag-ku::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 6px; height: 6px; background: #FFC000; border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 192, 0, 0.5);
}

/* Iraq Flag */
.flag-ar {
    background: linear-gradient(to bottom, #CE1126 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #000000 66.66%);
}
.flag-ar::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 10px; height: 2px; background: #007A3D;
}

.chevron {
    font-size: 0.7rem;
    transition: transform 0.3s;
    opacity: 0.7;
}

.dropdown-btn.active .chevron {
    transform: rotate(180deg);
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#theme-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.3s ease;
}

/* ڕەنگی ئایکۆنەکان */
#theme-toggle-btn .fa-sun {
    color: #f39c12; /* زەرد بۆ خۆر */
    filter: drop-shadow(0 0 2px rgba(243, 156, 18, 0.5));
}

#theme-toggle-btn .fa-moon {
    color: #ffffff; /* سپی بۆ مانگ */
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

.icon-spin {
    animation: spinIcon 0.5s ease-in-out;
}

@keyframes spinIcon {
    0% { transform: rotate(0deg) scale(0.5); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.2); opacity: 1; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* --- Dashboard Layout Styles --- */
.dashboard-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: transparent;
    padding-top: 70px; /* Space for fixed header */
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(255, 255, 255, 0.4); /* For RTL: border is actually on the left visually if LTR, but RTL handles direction */
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 5px 0 15px rgba(0,0,0,0.05);
    flex-shrink: 0;
    overflow: hidden;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
}

body.dark-mode .sidebar {
    background: rgba(22, 27, 34, 0.85);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    direction: ltr;
    padding-right: 5px;
}

.nav-links::-webkit-scrollbar {
    width: 5px;
}
.nav-links::-webkit-scrollbar-track {
    background: transparent;
}
.nav-links::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.nav-links li {
    margin-bottom: 8px;
}

.sidebar-footer-item {
    margin-top: auto;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 10px;
}

.nav-links a {
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-color-light);
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: var(--primary-light);
    transform: translateX(-3px);
}

.nav-links a.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
}

.nav-links a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 4px;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

.nav-links a.logout-link {
    color: var(--danger-color);
}

.nav-links a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    padding: 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
    z-index: 1100;
    transition: all 0.3s ease;
}

body.dark-mode .top-header {
    background: rgba(22, 27, 34, 0.6);
    background: rgba(22, 27, 34, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

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

.header-title h2 {
    display: none; /* Hide large title on header to save space */
}

.header-title p {
    display: none;
}

.header-logo-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.header-logo-display h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.header-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-logo-display:hover {
    background: rgba(0,0,0,0.04);
}

body.dark-mode .header-logo-display:hover {
    background: rgba(255,255,255,0.05);
}

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

.action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.8);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

body.dark-mode .action-btn {
    background: rgba(48, 54, 61, 0.8);
    color: #fff;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

/* Language Button Style */
.lang-btn {
    height: 38px;
    padding: 0 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

body.dark-mode .lang-btn {
    background: rgba(48, 54, 61, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* User Profile Style */
.user-profile-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 15px 5px 5px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: default;
    direction: ltr;
}

body.dark-mode .user-profile-display {
    background: rgba(48, 54, 61, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

.profile-icon-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border: 2px solid #fff;
    border-radius: 50%;
    display: none; /* Hidden by default, shown via JS */
    box-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
    transition: all 0.3s ease;
    animation: pulse-green 2s infinite;
}

body.dark-mode .online-dot {
    border-color: #2d3748;
}

.user-email-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

@media (max-width: 768px) {
    .header-logo-display h2 {
        display: none;
    }
    .action-btn {
        width: 34px;
        height: 34px;
    }
}
/* In-page Content Loader */
.content-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    width: 100%;
    grid-column: 1 / -1; /* Make it span all columns in a grid */
    color: var(--text-color-light);
}

.content-loader .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Custom Confirm Modal Styles */
.modal-content.small-modal {
    max-width: 380px;
    text-align: center;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-content.small-modal .modal-body {
    padding: 30px 25px;
}

.warning-icon {
    font-size: 3rem;
    color: #f59e0b; /* Warning yellow */
    margin-bottom: 15px;
    display: block;
}

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

.save-btn.danger:hover {
    filter: brightness(1.15);
}

#sidebar-toggle {
    display: flex;
    margin-left: 0;
    background: transparent;
    box-shadow: none;
    font-size: 1.2rem;
}

/* Sidebar Language Selector (Mobile) */
.sidebar-lang-section {
    display: none; /* Hidden on desktop */
    padding: 0 10px;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    direction: rtl;
}

.sidebar-lang-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px;
    color: var(--text-color-light);
    font-weight: 500;
}

.sidebar-lang-title i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-lang-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-bottom: 10px;
}

.sidebar-lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: rgba(255,255,255,0.5);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-lang-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.sidebar-lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

body.dark-mode .sidebar-lang-btn {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .sidebar-lang-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 995;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Special External Cards Section */
.special-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 25px 25px 0 25px;
    margin-bottom: -10px;
}

.special-card {
    position: relative;
    padding: 20px;
    border-radius: 20px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    animation: fadeInUpSmall 0.6s ease-out backwards;
}

.special-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    /* background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)); */
    z-index: 1;
}

@media (hover: hover) {
    .special-card:hover {
        transform: translateY(-8px) scale(1.03);
        box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    }
}

.special-card:active {
    transform: scale(0.98);
    filter: brightness(0.9);
}

.special-card:nth-child(1) { animation-delay: 0.1s; }
.special-card:nth-child(2) { animation-delay: 0.2s; }

.helpdesk-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.vacations-card {
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
}

.special-info h3 {
    font-size: 1.8rem;
    margin: 0;    
    font-weight: 800;
    z-index: 2;
    position: relative;
    letter-spacing: 1px;
}

.special-icon {
    font-size: 3rem;
    opacity: 0.8;
    z-index: 2;
    position: relative;
    /* padding-left: 10px; */
}

.external-badge {
    position: absolute;
    top: 15px;
    /* padding-right: 45px; */
    /* left: 15px; /* RTL handled by direction, but visually we want it in corner */
    /* right: 15px; */
    /* left: 15px; */
    /* background-color: red; */
    /* justify-content: flex-end; */
    /* text-align: right; */
    left: 15px;
    font-size: 0.9rem;
    opacity: 0.6;
    direction: ltr; /* Ensure badge is LTR */
}

.external-badge-right {
    left: auto;
    right: 15px;
}

/* Adjustments for English layout */
 .helpdesk-card .en .special-info,
 .vacations-card .en .special-info {
    order: 1; /* Moves the text to the left */
 }
 .helpdesk-card .en .special-icon,
 .vacations-card .en .special-icon {
    order: 2; /* Moves the icon to the right */
}

@media (max-width: 480px) {
    .special-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
}

/* Content Grid */
.content-grid {
    padding: 25px;
    overflow-y: auto;
    display: grid;
    /* Smaller cards */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    height: 100%;
    align-content: start;
}

.dashboard-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    animation: fadeInUpSmall 0.6s ease-out backwards;
}

@media (hover: hover) {
    .dashboard-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 20px 40px rgba(0,0,0,0.15);
        border-color: var(--primary-color);
    }
}

body.dark-mode .dashboard-card {
    border-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (hover: hover) {
    body.dark-mode .dashboard-card:hover {
        border-color: var(--primary-color);
    }
}

.dashboard-card:active {
    transform: scale(0.98);
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.icon-staff { color: #2ecc71; background: #eafaf1; }
.icon-leaves { color: #f39c12; background: #fef5e7; }
.icon-letters { color: #9b59b6; background: #f4ecf7; }
.icon-receipts { color: #e74c3c; background: #fdedec; }
.icon-files { color: #34495e; background: #ebedef; }
.icon-assets { color: #1abc9c; background: #e8f8f5; }
.icon-reports { color: #e67e22; background: #fdf2e9; }
.icon-settings { color: #686f87; background: #ebedef; }

.card-subtitle {
    opacity: 0.7;
}

.dashboard-card h3 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

/* Staggered Animation for Dashboard Cards */
.dashboard-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-card:nth-child(2) { animation-delay: 0.15s; }
.dashboard-card:nth-child(3) { animation-delay: 0.2s; }
.dashboard-card:nth-child(4) { animation-delay: 0.25s; }
.dashboard-card:nth-child(5) { animation-delay: 0.3s; }
.dashboard-card:nth-child(6) { animation-delay: 0.35s; }
.dashboard-card:nth-child(7) { animation-delay: 0.4s; }
.dashboard-card:nth-child(8) { animation-delay: 0.45s; }

/* Responsive Dashboard */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        right: -280px; /* Hide off-screen RTL */
        top: 70px; /* Below header */
        height: calc(100vh - 70px);
        width: 260px;
    }
    
    .sidebar.active {
        right: 0;
    }
    
    .sidebar.active ~ .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* On mobile, collapsed class does nothing or behaves differently */
    .sidebar.collapsed {
        width: 260px; 
    }
    
    .top-header {
        padding: 0 15px;
    }

    .top-header .custom-dropdown {
        display: none;
    }

    .sidebar-lang-section {
        display: block;
    }
}

@media (max-width: 480px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 10px 15px;
        gap: 8px;
    }

    /* Compact Dashboard Cards */
    .dashboard-card {
        padding: 15px;
    }
    .card-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    .dashboard-card h3 {
        font-size: 0.95rem;
    }

    /* Compact Special Cards (Slimmer) */
    .special-card {
        padding: 10px 15px;
    }
    .special-info h3 {
        font-size: 1.4rem;
    }
    .special-icon {
        font-size: 2.2rem;
    }

    /* Hide external link badge on mobile */
    .external-badge {
        display: none;
    }
}

/* --- PWA Install Card Styles --- */
.pwa-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 9998; /* Lower than the card */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.pwa-overlay.show {
    opacity: 1;
    visibility: visible;
}

.pwa-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8); /* Start centered but smaller */
    opacity: 0;
    visibility: hidden;
    width: 90%;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.65);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
}

.pwa-card.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

body.dark-mode .pwa-card {
    background: rgba(30, 35, 45, 0.65);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.pwa-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pwa-icon-wrapper img {
    width: 55px;
    height: 55px;
    background-color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.pwa-text h3 {
    font-size: 1rem;
    margin: 0 0 4px 0;
    font-weight: 700;
}

.pwa-text p {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.8;
    line-height: 1.4;
}

.pwa-actions {
    display: flex;
    gap: 10px;
}

.pwa-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.pwa-btn.dismiss { background: transparent; color: var(--text-color); border: 1px solid var(--input-border); }
.pwa-btn.install { background: var(--primary-color); color: white; box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3); }
.pwa-btn.install:active { transform: scale(0.96); }

/* --- iOS Install Modal Styles --- */
.ios-install-guide-img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid var(--input-border);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.ios-instructions {
    list-style: none;
    padding: 0;
    text-align: right;
    counter-reset: ios-steps;
}

.ios-instructions li {
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ios-instructions li::before {
    counter-increment: ios-steps;
    content: counter(ios-steps);
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ios-instructions i {
    color: var(--text-color-light);
    font-size: 1.5rem;
}

/* --- Update Notification Styles --- */
.update-card {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    width: 90%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--primary-color);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.update-card.show {
    transform: translateX(-50%) translateY(0);
}

.update-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.update-icon {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.update-text h3 { margin: 0; font-size: 0.95rem; }
.update-text p { margin: 0; font-size: 0.8rem; opacity: 0.8; }

.update-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Modern Dialog Styles (Shared) --- */
.dialog-content {
    max-width: 400px;
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
    background: var(--card-bg);
    animation: modalFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    width: 90%;
}

.dialog-header {
    padding: 15px 20px 10px 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    flex-shrink: 0;
    position: relative;
}

.dialog-icon-wrapper {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

.dialog-header-text h3 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    line-height: 1.4;
    color: var(--text-color);
}

.dialog-subtitle {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0,0,0,0.05);
    color: var(--text-color-light);
}

body.dark-mode .dialog-subtitle {
    background: rgba(255,255,255,0.1);
}

.dialog-close-btn {
    background: transparent;
    border: none;
    color: var(--text-color-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    position: absolute;
    top: 15px;
    left: 15px;
}

.dialog-close-btn:hover { color: var(--text-color); }

.dialog-body {
    padding: 10px 20px 20px 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.dialog-form-group {
    margin-bottom: 15px;
}

.dialog-form-group label {
    font-size: 0.85rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    font-weight: 600;
}

.dialog-form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    font-size: 0.95rem;
    color: var(--text-color);
    transition: border-color 0.2s;
}

.dialog-footer {
    padding: 0 20px 20px 20px;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 10px;
    flex-shrink: 0;
}

.dialog-cancel-btn, .dialog-save-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dialog-cancel-btn {
    background: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--input-border);
}

.dialog-save-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.dialog-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 144, 226, 0.4);
}

.dialog-save-btn:active {
    transform: scale(0.98);
}

/* Password Match Indicator */
.match-indicator {
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
    text-align: right;
    font-weight: 600;
    height: 1.2em; /* Prevent layout shift */
    transition: color 0.3s;
}
.match-indicator.match { color: #2ecc71; }
.match-indicator.mismatch { color: #e74c3c; }

/* Compact Form for Password Change */
#change-password-form .dialog-form-group {
    margin-bottom: 10px; /* Reduced margin for compact look */
}
#change-password-form input {
    padding: 8px 12px; /* Slightly reduced padding */
}

.email-change-notice {
    font-size: 0.8rem;
    color: var(--text-color-light);
    background: var(--input-bg);
    padding: 10px;
    border-radius: 8px;
    line-height: 1.5;
    margin-top: -5px;
    margin-bottom: 15px;
    text-align: center;
}

.form-divider {
    border: none;
    height: 1px;
    background-color: var(--input-border);
    margin: 20px 0;
}

/* Compact Edit Profile Modal */
#edit-profile-modal .dialog-content {
    max-width: 320px;
}

#edit-profile-modal .dialog-header {
    padding: 12px 15px 5px 15px;
}

#edit-profile-modal .dialog-header-text h3 {
    font-size: 1rem;
}

#edit-profile-modal .dialog-body {
    padding: 5px 15px 10px 15px;
}

#edit-profile-modal .dialog-form-group {
    margin-bottom: 8px;
}

#edit-profile-modal .dialog-form-group label {
    font-size: 0.8rem;
    margin-bottom: 3px;
}

#edit-profile-modal input {
    height: 36px;
    padding: 4px 10px;
    font-size: 0.9rem;
}

#edit-profile-modal .email-change-notice {
    margin-bottom: 8px;
    padding: 6px;
    font-size: 0.7rem;
    line-height: 1.3;
}

#edit-profile-modal .form-divider {
    margin: 8px 0;
}

#edit-profile-modal .dialog-footer {
    padding: 0 15px 15px 15px;
}

#edit-profile-modal .dialog-save-btn, 
#edit-profile-modal .dialog-cancel-btn {
    padding: 8px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* QR Code Container */
.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px; /* زیادکردنی بۆشایی بۆ ئەوەی کامێرا باشتر بیخوێنێتەوە */
    background: white;
    border-radius: 16px;
    border: 1px solid var(--input-border);
    margin: 10px auto; /* هێنانە ناوەڕاست */
    max-width: 280px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.qr-code-container svg {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
}

.qr-code-container img {
    width: 100%;
    height: auto;
    display: block;
}

.mfa-status-badge {
    font-size: 0.85rem;
    font-weight: 700;
    margin-left: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s;
}
.mfa-status-badge.active { color: #2ecc71; background: rgba(46, 204, 113, 0.1); }
.mfa-status-badge.inactive { color: var(--text-color-light); background: rgba(0,0,0,0.05); }

/* Compact MFA Login Modal */
#mfa-login-modal .card {
    padding: 20px 25px;
    max-width: 320px;
}

#mfa-login-modal h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

#mfa-login-modal p {
    font-size: 0.85rem;
    margin-bottom: 15px !important;
}

#mfa-login-modal .otp-input {
    height: 42px;
    font-size: 1.1rem !important;
    padding: 5px !important;
}

#mfa-login-modal button[type="submit"] {
    padding: 10px;
    font-size: 0.95rem;
    margin-top: 5px;
}

#mfa-login-modal p {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-color-light);
}

/* Compact MFA Setup Modal (QR Code Card) */
#mfa-setup-modal .dialog-content {
    max-width: 340px;
}

#mfa-setup-modal .dialog-header {
    padding: 15px 20px 5px 20px;
}

#mfa-setup-modal .dialog-header-text h3 {
    font-size: 1.05rem;
}

#mfa-setup-modal .dialog-body {
    padding: 5px 20px 20px 20px;
}

#mfa-setup-modal .qr-code-container {
    padding: 5px;
    width: 240px;
    height: 240px;
    max-width: 100%;
    margin: 5px auto 15px auto;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mfa-setup-modal #mfa-qr-desc {
    font-size: 0.85rem;
    margin-bottom: 10px !important;
    text-align: center;
}

#mfa-setup-modal .qr-code-container svg,
#mfa-setup-modal .qr-code-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

#mfa-setup-modal .dialog-form-group {
    margin-top: 10px !important;
    margin-bottom: 15px;
}

#mfa-setup-modal input#mfa-verify-code {
    height: 40px;
    font-size: 1.1rem !important;
    padding: 5px !important;
    text-align: center;
    letter-spacing: 5px;
}

#mfa-setup-modal .dialog-save-btn {
    padding: 10px;
    font-size: 0.95rem;
}

#mfa-login-modal .otp-input {
    text-align: center;
    letter-spacing: 5px;
}

/* Confirmation Modal Styles */
.dialog-body.centered {
    text-align: center;
    padding: 30px 25px;
}
.dialog-body .warning-icon {
    font-size: 3rem;
    color: #f59e0b; /* A standard warning color */
    margin-bottom: 15px;
    display: block;
}
.dialog-body .confirm-text {
    color: var(--text-color-light);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 10px;
}
.dialog-footer.centered {
    grid-template-columns: 1fr 1fr;
}
.dialog-save-btn.danger {
    background: var(--danger-color);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}
.dialog-save-btn.danger:hover {
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4);
}

/* Specific modal content widths */
#color-picker-modal .dialog-content,
#confirm-cache-clear-modal .dialog-content,
#confirm-logout-all-modal .dialog-content,
#confirm-disable-mfa-modal .dialog-content {
    max-width: 380px;
}

#confirm-logout-all-modal .warning-icon {
    color: var(--primary-color);
}

/* User Management Styles */
.users-list-toolbar {
    margin-bottom: 15px;
}

.add-user-btn {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px dashed var(--primary-color);
    color: var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.add-user-btn:hover {
    background: var(--primary-light);
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--input-bg);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--input-border);
}

.user-item-info h4 { margin: 0 0 4px 0; font-size: 0.95rem; }
.user-item-info p { margin: 0; font-size: 0.8rem; color: var(--text-color-light); }

.delete-user-btn {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: 0.2s;
}
.delete-user-btn:hover { background: #e74c3c; color: white; }

/* Add User Form Styles */
#add-user-form-container {
    display: none;
}

#add-user-form-container h4 {
    margin-bottom: 15px;
}

.add-user-footer {
    padding: 0 !important;
    margin-top: 15px;
}

.warning-icon.danger-icon {
    color: var(--danger-color);
}
