/* Kartix Unified Professional Theme - Light Blue & Clean White */
/* این فایل وظیفه تعریف و بارگذاری فونت های «فونت ایران» را برعهده دارد */
/* پیشنهاد می شود از روش قبل استفاده کنید */
@font-face {
font-family: YekanBakh;
font-style: normal;
font-weight: bold;
src: url('fonts/YekanBakhFaNum-Bold.woff2');
src: url('fonts/YekanBakhFaNum-Bold.woff2?#iefix') format('embedded-opentype'), /* IE6-8 */
url('fonts/YekanBakhFaNum-Bold.woff2') format('woff2'), /* Chrome36+, Opera24+*/
url('fonts/YekanBakhFaNum-Bold.woff2') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('fonts/YekanBakhFaNum-Bold.woff2') format('truetype');
}

:root {
    --primary-color: #2d8cff;
    --primary-hover: #1e70e0;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-body: #f0f2f5;
    --bg-card: rgba(255, 255, 255, 0.7); /* Glass effect */
    --text-main: #1a1a1a;
    --text-muted: #5f6c79;
    --border-color: rgba(255, 255, 255, 0.3);
    --header-gradient: linear-gradient(90deg, #2d8cff, #68b0ff);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: YekanBakh,Tahoma, "Segoe UI", sans-serif !important;
    direction: rtl;
    text-align: right;
    background: linear-gradient(135deg, #f0f2f5 0%, #e0e5ec 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    height: 100%;
}

/* Force Tahoma on everything */
*, button, input, select, textarea {
    font-family: YekanBakh,Tahoma, "Segoe UI", sans-serif !important;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Brand */
.app-header {
    background: var(--primary-color) !important; /* Unified blue color */
    color: #ffffff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
    justify-content: space-between;
    z-index: 1000;
}

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

.app-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    padding: 2px;
}

.app-title {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

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

/* User & Notification Menus */
.user-menu, .notif-menu {
    position: relative;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-toggle, .notif-toggle {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.notif-toggle svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

.user-menu-toggle:hover, .notif-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.user-menu.open .user-menu-dropdown,
.notif-menu.open .notif-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    z-index: 2000 !important;
}

.user-menu-dropdown, .notif-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    min-width: 220px;
    display: none;
    z-index: 1100;
    overflow: hidden;
    transition: all 0.2s ease;
}

.user-menu-item, .notif-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f2f5;
}

.user-menu-item:hover, .notif-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

/* Searchable Select (Custom Dropdown UI) */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-display {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    position: relative;
    transition: all 0.2s;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.searchable-select-display:after {
    content: "▼";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-muted);
}

.searchable-select-display:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.1);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin-top: 4px;
    display: none;
    max-height: 350px;
    flex-direction: column;
    animation: dropdownFadeIn 0.2s ease;
}

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

.searchable-select-dropdown.open {
    display: flex;
}

.searchable-select-input {
    margin: 10px !important;
    width: calc(100% - 20px) !important;
    padding: 10px 14px !important;
    border: 1.5px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    outline: none !important;
    background: #f9f9f9 !important;
    transition: all 0.2s;
}

.searchable-select-input:focus {
    background: #fff !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.1) !important;
}

.searchable-select-options {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    flex: 1;
}

.searchable-select-options li {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
    border-bottom: 1px solid #f8f9fa;
}

.searchable-select-options li:hover {
    background: #f0f7ff;
    color: var(--primary-color);
}

.searchable-select-options li.selected {
    background: var(--primary-color);
    color: #fff;
}

/* Ensure complex fields are full width */
.field-item.full, 
.field-item[data-type="call_log"], 
.field-item[data-type="proforma"], 
.field-item[data-type="invoice"] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

.call-log-container, .proforma-container {
    width: 100%;
    overflow-x: auto;
}

.call-log-container table, .proforma-container table {
    width: 100% !important;
}

.invoice-table, .proforma-table, .call-log-table {
    width: 100% !important;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.invoice-table th, .proforma-table th, .call-log-table th {
    background: rgba(248, 249, 250, 0.5);
    backdrop-filter: blur(4px);
    color: var(--text-main);
    font-weight: 600;
    padding: 12px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

th {
    background: rgba(45, 140, 255, 0.1);
    padding: 12px 15px;
    text-align: right;
    font-weight: 700;
    border-bottom: 2px solid var(--glass-border);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--glass-border);
}

tr:hover {
    background: rgba(255, 255, 255, 0.2);
}

.invoice-table td, .proforma-table td, .call-log-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}

.invoice-table input, .proforma-table input, .call-log-table textarea {
    border: 1px solid transparent;
    background: transparent;
    padding: 8px;
    width: 100%;
}

.invoice-table input:focus, .proforma-table input:focus, .call-log-table textarea:focus {
    border-color: var(--primary-color);
    background: #fff;
}

.invoice-total-row, .proforma-total-row {
    background: #f8f9fa;
    font-weight: bold;
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
}

.custom-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.task-header-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    border-top: 5px solid var(--primary-color);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    gap: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 100;
    padding: 10px 0;
}

.task-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.task-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: stretch;
}

.task-action-row .action-btn, 
.task-action-row button {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.gold { background-color: #f1c40f; color: #000; }
.action-btn.indigo { background-color: #3f51b5; color: #fff; }
.action-btn.secondary { background-color: #ecf0f1; color: #333; }

.action-btn:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.task-title {
    margin: 0;
    font-size: 11px;
    color: var(--text-main);
}

.task-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    background: #f8f9fa;
    padding: 16px;
    border-radius: var(--radius);
}

.task-meta-item {
    font-size: 13px;
}

.task-meta-label {
    color: var(--text-muted);
    margin-left: 4px;
}

.task-meta-value {
    color: var(--text-main);
    font-weight: 600;
}

.comment-section {
    margin-top: 32px;
}

.comment-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.comment-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
}

.comment-user {
    font-weight: bold;
    color: var(--primary-color);
}

/* Mentions */
.mention-wrap { position: relative; }
.mention-suggest {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow: hidden;
    z-index: 1200;
    display: none;
}
.mention-suggest.show { display: block; }
.mention-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
}
.mention-item:hover { background: #e7f1ff; color: var(--primary-color); }

.field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.field-wrapper input, .field-wrapper select {
    padding-left: 35px !important;
}

.field-wrapper textarea {
    padding-left: 35px !important;
}

.field-wrapper .scale-options, 
.field-wrapper .options-inline,
.field-wrapper .repeater-container,
.field-wrapper .proforma-container {
    padding-left: 35px;
    width: 100%;
}

.x-clear {
    background: none !important;
    border: none !important;
    color: #cbd5e1 !important;
    font-size: 18px !important;
    cursor: pointer;
    padding: 0 !important;
    position: absolute;
    left: 8px;
    top: 10px; /* Position at top-left corner instead of center */
    box-shadow: none !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    transition: all 0.2s;
    z-index: 5;
    background: #fff !important; /* White background to ensure it stands out */
    border: 1px solid #e2e8f0 !important;
}

.x-clear:hover {
    color: #ef4444 !important;
    background: #fee2e2 !important;
    border-color: #fecaca !important;
    transform: scale(1.1);
}

/* Ensure X doesn't overlap dropdown arrows */
.field-wrapper select + .x-clear,
.field-wrapper .searchable-select-wrapper + .x-clear {
    left: 40px; /* Moved even further left to avoid arrow overlap */
}

/* Field Grid Layout */
.stage-panel .field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.stage-panel .field-item.full {
    grid-column: 1 / -1;
}

.notif-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--danger-color);
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-color);
}

/* Navigation */
.nav-bar {
    background: rgba(45, 140, 255, 0.7) !important; /* Glassy blue */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0 20px;
    border-radius: var(--radius-lg);
    margin: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-height: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
}

.nav-item {
    color: #ffffff !important;
    text-decoration: none;
    padding: 10px 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    border-radius: var(--radius);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 700;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.nav-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    width: 20px;
    height: 20px;
    justify-content: center;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.app-main {
    flex: 1 0 auto;
    padding: 24px;
}

.app-footer {
    flex-shrink: 0;
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
    padding: 10px 24px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
    position: sticky;
    bottom: 0;
    width: 100%;
    z-index: 999; /* Ensure it stays above other content but below modals */
}

.footer-left {
    order: 2; /* In RTL, left is visually right, so we might need to adjust based on direction */
}

.footer-right {
    order: 1;
}

/* If direction is RTL, .footer-left is on the left side of the screen */
[dir="rtl"] .footer-left { order: 1; }
[dir="rtl"] .footer-right { order: 2; }

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.login-logo img {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px !important;
    font-size: 16px !important;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
    color: #a0aec0;
}

/* Kanban Board & Columns */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 15px;
    align-items: stretch; /* Make all columns same height as board */
    height: calc(100vh - 170px);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    margin: 10px;
    border: 1px solid var(--glass-border);
}

.kanban-column {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 280px;
    width: 280px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    height: 100%; /* Take full height of board */
    max-height: 100%; /* Don't exceed board height */
    min-height: 0; /* Critical for flex scrolling */
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    .kanban-column {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 500px;
        margin-bottom: 20px;
    }
}

.kanban-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    margin-bottom: 12px;
}

.kanban-card-link:hover, .kanban-card-link:focus, .kanban-card-link:active {
    text-decoration: none !important;
    outline: none;
}

.kanban-column-header {
    padding: 16px;
    font-weight: bold;
    font-size: 15px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-column-body {
    padding: 12px;
    overflow-y: auto; /* Independent vertical scrolling for cards */
    flex: 1;
    min-height: 0; /* Important for flex child scrolling */
}

/* Scrollbar on the right for RTL is default, but ensuring it looks good */
.kanban-column-body::-webkit-scrollbar {
    width: 6px;
}
.kanban-column-body::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.kanban-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none !important;
}

.kanban-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

.kanban-card * {
    text-decoration: none !important;
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.4;
    margin-top: 15px;
}

.kanban-card-meta {
    font-size: 11px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.card-badge {
    position: absolute;
    top: 10px;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none !important;
}

.card-badge.elapsed {
    left: 10px;
    top: 8px;
    background: #f1f3f5;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.card-badge.priority {
    right: 10px;
    top: 8px;
    color: #fff;
    font-weight: bold;
    font-size: 9px;
    text-transform: uppercase;
}

.card-badge.priority.priority-high { background-color: var(--danger-color); }
.card-badge.priority.priority-normal { background-color: var(--primary-color); }
.card-badge.priority.priority-low { background-color: var(--success-color); }

.card-due {
    font-size: 11px;
    margin-bottom: 8px;
    font-weight: 600;
}

.due-future { color: #27ae60; } /* Green */
.due-today  { color: #f39c12; } /* Yellow/Orange */
.due-past   { color: #e74c3c; } /* Red */

.card-extras-container {
    border-top: 1px solid #f1f3f5;
    margin-top: 8px;
    padding-top: 8px;
}

.card-extra-field {
    font-size: 12px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    text-decoration: none !important;
}

.card-extra-label {
    color: var(--text-muted);
}

.card-extra-value {
    color: var(--text-main);
    font-weight: normal !important;
    text-decoration: none !important;
}

.card-extra-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.card-extra-user img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.card-preview-image {
    margin: -14px -14px 10px -14px;
    height: 10vh;
    max-height: 120px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.card-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* General Cards & Forms */
/* Responsive Form Grid */
.responsive-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.form-group-title {
    grid-column: 1 / -1;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 15px 0 5px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(45, 140, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-field-modern {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field-modern label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.form-field-modern input, 
.form-field-modern select, 
.form-field-modern textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fff;
}

.form-field-modern input:focus, 
.form-field-modern select:focus, 
.form-field-modern textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(45, 140, 255, 0.1);
    outline: none;
}

.form-field-modern.full-width {
    grid-column: 1 / -1;
}

/* Modal Enhancements */
.modal-content.large {
    max-width: 850px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 20px 30px;
}

.modal-body-scrollable {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8fafc;
}

.public-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    margin-bottom: 24px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.public-card:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

.public-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid #f1f3f5;
    padding-bottom: 12px;
}

/* Contact Popup Styles */
.contact-popup {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 300px;
    z-index: 3000;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: popupFadeIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupFadeIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.popup-avatar, .popup-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.popup-avatar-placeholder {
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.popup-header h4 {
    margin: 0;
    flex: 1;
    font-size: 16px;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.popup-methods-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.popup-method-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    background: #f8f9fa;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 20px;
    border: 1px solid #eee;
}

.popup-method-btn:hover {
    background: var(--brand-color);
    border-color: var(--brand-color);
    transform: scale(1.1);
}

.popup-method-btn:hover .method-icon {
    filter: brightness(0) invert(1);
}

.task-referral-flow {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row; /* In RTL, this is right-to-left */
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    border: 1px solid var(--glass-border);
}

.flow-user {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.flow-user img, .flow-user .avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.flow-user .avatar-placeholder {
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary-color);
}

.flow-user:hover {
    transform: scale(1.2) translateY(-5px);
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.flow-arrow {
    font-size: 20px;
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.two-forms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 992px) {
    .two-forms {
        grid-template-columns: 1fr;
    }
}

.form-field.full { grid-column: 1 / -1; }

/* File Upload Box */
.file-upload-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}

.file-upload-box {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.file-upload-box:hover, .file-upload-box.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.file-upload-box .upload-icon {
    font-size: 32px;
    color: #94a3b8;
}

.file-upload-box .upload-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.file-upload-box .file-name {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 5px;
    display: none;
}

.file-upload-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-main);
}

input[type="text"], input[type="password"], input[type="number"], 
input[type="email"], input[type="date"], select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(45, 140, 255, 0.15), inset 0 1px 2px rgba(0,0,0,0.02);
    transform: translateY(-1px);
}

input::placeholder {
    color: #a0aec0;
}

button, input[type="submit"] {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

button:hover, input[type="submit"]:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

button:active, input[type="submit"]:active {
    transform: translateY(0);
}

button.secondary {
    background-color: #f8f9fa;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

button.secondary:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-link {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #000000 !important; /* Force black font */
    border-radius: var(--radius);
    transition: all 0.2s;
    opacity: 0.7;
}

.tab-link:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.tab-link.active {
    background: var(--primary-color);
    color: #ffffff !important;
    opacity: 1;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Better Tables and Buttons */
.process-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

th {
    background-color: #f8f9fa;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    text-align: right;
    font-weight: bold;
    font-size: 13px;
}

.process-actions form {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

/* Modern Button Styles */
.button, button, input[type="submit"], input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    font-family: inherit;
}

.button.primary, input[type="submit"] {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(45, 140, 255, 0.25);
}

.button.primary:hover, input[type="submit"]:hover {
    background: #1a7fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(45, 140, 255, 0.35);
}

.button.danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.button.danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.button.secondary, button.secondary, .btn-icon {
    background: #fff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}

.button.secondary:hover, button.secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

.btn-icon:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.05);
}

.btn-icon.delete:hover {
    background: #fff1f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-icon.view:hover {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #22c55e;
}

/* Action Groups in Tables */
.table-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

/* User Log Styles */
.log-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    align-items: flex-end;
}
.log-filters .filter-group {
    flex: 1;
    min-width: 200px;
}
.log-table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.log-table {
    width: 100%;
    border-collapse: collapse;
}
.log-table th {
    background: #f8fafc;
    padding: 14px 16px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 2px solid #edf2f7;
    color: var(--text-muted);
}
.log-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 13px;
    vertical-align: middle;
}
.log-table tr:hover {
    background: #fdfdfd;
}
.log-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.log-badge.login { background: #dcfce7; color: #166534; }
.log-badge.task { background: #dbeafe; color: #1e40af; }
.log-badge.settings { background: #fef3c7; color: #92400e; }
.log-badge.other { background: #f1f5f9; color: #475569; }

.log-details-cell {
    font-size: 12px;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #475569;
}

/* Contact Cards Design - Mobile Style */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.contact-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    border: 1px solid #eef2f6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.contact-card-avatar, .contact-card-avatar-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 5px solid #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    object-fit: cover;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    color: #475569;
    font-weight: 800;
}

.contact-card-name {
    font-size: 19px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.2;
}

.contact-card-org {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 18px;
    font-weight: 600;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 20px;
}

.contact-card-quick-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    width: 100%;
}

.contact-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #475569;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 20px;
    border: 1.5px solid #e2e8f0;
}

.contact-action-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.contact-action-btn.call:hover { background: #dcfce7; color: #166534; border-color: #166534; }
.contact-action-btn.sms:hover { background: #dbeafe; color: #1e40af; border-color: #1e40af; }
.contact-action-btn.email:hover { background: #fee2e2; color: #991b1b; border-color: #991b1b; }

.contact-card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.contact-action-btn.delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.contact-card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Scale / Range Fields */
.scale-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.scale-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.scale-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
    min-width: 0;
}

.scale-option:hover {
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.scale-option input[type="radio"]:checked + .scale-label {
    color: var(--primary-color);
}

.scale-option:has(input[type="radio"]:checked) {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(45, 140, 255, 0.1);
}

.scale-option input[type="radio"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--primary-color);
}

.scale-label {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    word-break: break-word;
    line-height: 1.1;
}

.scale-option.active .scale-label {
    color: var(--primary-color);
}

@media (max-width: 600px) {
    .scale-options {
        flex-direction: column;
        align-items: stretch;
    }
    .scale-option {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 15px;
    }
}

/* Modal Enhancements */
.modal-content.large {
    max-width: 800px;
    width: 90%;
    margin: 20px auto;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    min-height: 200px;
}

.modal-body-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted minmax from 280px to 200px */
    gap: 20px;
}

.quick-action-btn.call:hover { background: #22c55e; border-color: #22c55e; }
.quick-action-btn.sms:hover { background: #3b82f6; border-color: #3b82f6; }
.quick-action-btn.email:hover { background: #ef4444; border-color: #ef4444; }

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

tr:hover td {
    background-color: rgba(45, 140, 255, 0.02);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #fbfcfc; }

/* Task View Special Components */
.stage-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: -1px;
}

.stage-tab {
    padding: 10px 20px;
    background: #f1f3f5;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
}

.stage-tab.active {
    background: #fff;
    color: var(--primary-color);
    font-weight: bold;
    border-top: 3px solid var(--primary-color);
}

.stage-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 0 0 var(--radius) var(--radius);
    display: none;
}

.stage-panel.active { display: block; }

.options-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    margin-top: 5px;
}

.options-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 13.5px;
}

.options-inline label:hover {
    color: var(--primary-color);
}

.options-inline input[type="radio"], 
.options-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Call Log Enhancements */
.repeater-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repeater-row {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s;
}

.repeater-row:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.call-log-grid {
    display: grid;
    grid-template-columns: 110px 100px 100px 140px 1fr auto;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .call-log-grid {
        grid-template-columns: 1fr 1fr;
    }
    .call-log-grid .full-mobile {
        grid-column: 1 / -1;
    }
}

/* Searchable Select Fixes */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-display {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    padding-left: 35px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-display::after {
    content: '▼';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #94a3b8;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 10px 10px;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
}

.searchable-select-dropdown.open {
    display: block;
}

.searchable-select-input {
    width: calc(100% - 20px);
    margin: 10px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
}

.searchable-select-options {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

.searchable-select-options li {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 13.5px;
    border-bottom: 1px solid #f1f5f9;
}

.searchable-select-options li:hover {
    background: #f1f5f9;
}

.searchable-select-options li.selected {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
}

/* Chat / AI Reports */
.chat-messages {
    height: 500px;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
}

.chat-msg.me { align-self: flex-start; }
.chat-msg.me .chat-bubble {
    background: var(--primary-color);
    color: #fff;
}

.chat-msg.ai { align-self: flex-end; }
.chat-msg.ai .chat-bubble {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.alert.success {
    background: rgba(40, 167, 69, 0.2);
    color: #1e7e34;
    border-color: rgba(40, 167, 69, 0.3);
}

.alert.error {
    background: rgba(220, 53, 69, 0.2);
    color: #bd2130;
    border-color: rgba(220, 53, 69, 0.3);
}

.alert.info {
    background: rgba(45, 140, 255, 0.2);
    color: #1a7fff;
    border-color: rgba(45, 140, 255, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-main { padding: 12px; }
    
    .nav-bar {
        padding: 0 10px;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .nav-item {
        padding: 10px 12px;
        font-size: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .two-forms {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        height: auto;
        min-height: calc(100vh - 150px);
        padding-bottom: 20px;
        flex-direction: row !important; /* Force row for horizontal scroll */
        align-items: flex-start;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        direction: rtl !important;
    }

    .kanban-column {
        min-width: 85vw; /* Almost full width but showing next column */
        max-width: 85vw;
        height: calc(100vh - 200px);
        flex-shrink: 0 !important;
    }

    table {
        display: block;
        overflow-x: auto;
        width: 100%;
    }

    .process-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .process-actions form {
        width: 100%;
    }

    .process-actions button, .process-actions input, .process-actions select {
        width: 100% !important;
        margin-bottom: 5px;
    }
    
    /* Fix for large forms/tables causing overflow */
    .public-card, .stage-panel, .task-header-card {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    input, select, textarea, button {
        max-width: 100%;
        box-sizing: border-box;
    }
}

.hidden { display: none !important; }

/* Jalali Calendar Styles */
.jalali-calendar {
    position: absolute;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    font-size: 12px;
    direction: rtl;
    min-width: 240px;
    box-shadow: var(--shadow-md);
    z-index: 2000;
}

.jalali-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.jalali-calendar-header button {
    padding: 2px 8px;
    background: #f1f3f5;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.jalali-calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
    font-weight: bold;
    color: var(--text-muted);
}

.jalali-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.jalali-calendar-grid button {
    border: 1px solid transparent;
    background: none;
    color: var(--text-main);
    padding: 6px 0;
    border-radius: 4px;
}

.jalali-calendar-grid button:hover {
    background: #e7f1ff;
    color: var(--primary-color);
}

.jalali-calendar-grid button.selected {
    background: var(--primary-color);
    color: #fff;
}

.jalali-calendar-grid .empty { visibility: hidden; }

/* Filter Buttons */
.filter-btn {
    padding: 8px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: none;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.filter-btn.active {
    background: #fff !important;
    color: var(--primary-color) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
}
.modal-content {
    background: #fff;
    margin: 40px auto;
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh; /* Added max-height */
    display: flex;
    flex-direction: column;
}
.modal-body { 
    padding: 24px;
    overflow-y: auto; /* Added vertical scroll */
    flex: 1;
    min-height: 0; /* Ensure it can shrink */
}

/* Specific styles for forms within modals */
.modal-body .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.modal-body .form-field.full {
    grid-column: 1 / -1;
}

.modal-body .checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 150px; /* Limit height for scrolling */
    overflow-y: auto; /* Enable scrolling for the checkbox grid */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.modal-body .checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.modal-body .checkbox-item input[type="checkbox"] {
    margin-left: 5px; /* Adjust margin for RTL */
}

/* Adjustments for RTL */
html[dir="rtl"] .modal-body .checkbox-item input[type="checkbox"] {
    margin-right: 5px;
    margin-left: 0;
}
.modal-header {
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}
.close-modal {
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    transition: color 0.2s;
}
.close-modal:hover { color: #ef4444; }

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0; /* Prevent footer from shrinking */
}

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