/**
 * Zibel Team Management - Design System & Styles
 * Mobile-First, RTL, Minimalist, High-Performance
 */

:root {
    --zb-primary: #7c3aed;
    --zb-primary-hover: #6d28d9;
    --zb-primary-light: #f5f3ff;
    --zb-primary-border: #ddd6fe;

    --zb-navy: #0f172a;
    --zb-navy-light: #1e293b;
    --zb-navy-card: #334155;

    --zb-bg-page: #f8fafc;
    --zb-bg-card: #ffffff;
    --zb-bg-muted: #f1f5f9;
    --zb-border: #e2e8f0;
    --zb-border-hover: #cbd5e1;

    --zb-text-main: #0f172a;
    --zb-text-muted: #64748b;
    --zb-text-light: #94a3b8;

    --zb-success: #10b981;
    --zb-success-bg: #ecfdf5;
    --zb-success-border: #a7f3d0;

    --zb-warning: #f59e0b;
    --zb-warning-bg: #fffbeb;
    --zb-warning-border: #fde68a;

    --zb-danger: #ef4444;
    --zb-danger-bg: #fef2f2;
    --zb-danger-border: #fecaca;

    --zb-info: #0284c7;
    --zb-info-bg: #f0f9ff;
    --zb-info-border: #bae6fd;

    --zb-radius-sm: 8px;
    --zb-radius-md: 12px;
    --zb-radius-lg: 16px;
    --zb-radius-full: 9999px;

    --zb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --zb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --zb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    --zb-font: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --zb-touch-size: 44px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--zb-font);
    background-color: var(--zb-bg-page);
    color: var(--zb-text-main);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--zb-navy);
    margin-top: 0;
}

p {
    margin-top: 0;
    line-height: 1.6;
}

a {
    color: var(--zb-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--zb-primary-hover);
}

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

.app-sidebar {
    width: 260px;
    background-color: #ffffff;
    border-left: 1px solid var(--zb-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
}

.app-main {
    flex: 1;
    margin-right: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-bottom: 80px; /* Space for mobile nav */
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    }
    .app-main {
        margin-right: 0;
    }
}

/* Top Header */
.app-topbar {
    height: 64px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--zb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Brand */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--zb-primary);
    text-decoration: none;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    border-radius: var(--zb-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

/* Navigation items */
.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--zb-text-muted);
    font-weight: 500;
    border-radius: var(--zb-radius-md);
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.nav-link-custom:hover {
    color: var(--zb-primary);
    background-color: var(--zb-primary-light);
}

.nav-link-custom.active {
    color: var(--zb-primary);
    background-color: var(--zb-primary-light);
    font-weight: 700;
    border-right: 3px solid var(--zb-primary);
}

/* Cards */
.zb-card {
    background-color: var(--zb-bg-card);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-md);
    box-shadow: var(--zb-shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.zb-card-hover:hover {
    box-shadow: var(--zb-shadow-md);
    border-color: var(--zb-border-hover);
}

/* Task Cards */
.task-card {
    background-color: #ffffff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
    border-right-width: 4px;
    transition: all 0.2s ease;
}

.task-card:hover {
    box-shadow: var(--zb-shadow-md);
}

.task-card.priority-normal {
    border-right-color: var(--zb-text-light);
}

.task-card.priority-important {
    border-right-color: var(--zb-warning);
}

.task-card.priority-urgent {
    border-right-color: var(--zb-danger);
}

.task-card.is-overdue {
    background-color: #fffaf9;
    border-right-color: var(--zb-danger);
}

.task-card.is-completed {
    background-color: #fcfdfd;
    border-right-color: var(--zb-success);
    opacity: 0.85;
}

.task-card.is-completed .task-title {
    text-decoration: line-through;
    color: var(--zb-text-muted);
}

/* Quick Action Checkbox / One-touch complete button */
.complete-btn {
    min-width: var(--zb-touch-size);
    min-height: var(--zb-touch-size);
    border-radius: var(--zb-radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--zb-border-hover);
    background: transparent;
    color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.complete-btn:hover {
    border-color: var(--zb-success);
    background-color: var(--zb-success-bg);
    color: var(--zb-success);
}

.complete-btn.completed {
    background-color: var(--zb-success);
    border-color: var(--zb-success);
    color: #ffffff;
}

/* Stat Cards */
.stat-card {
    background-color: #ffffff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 84px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--zb-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.825rem;
    color: var(--zb-text-muted);
}

/* Badges */
.zb-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--zb-radius-full);
}

.zb-badge-success {
    background-color: var(--zb-success-bg);
    color: var(--zb-success);
    border: 1px solid var(--zb-success-border);
}

.zb-badge-warning {
    background-color: var(--zb-warning-bg);
    color: #b45309;
    border: 1px solid var(--zb-warning-border);
}

.zb-badge-danger {
    background-color: var(--zb-danger-bg);
    color: var(--zb-danger);
    border: 1px solid var(--zb-danger-border);
}

.zb-badge-info {
    background-color: var(--zb-info-bg);
    color: var(--zb-info);
    border: 1px solid var(--zb-info-border);
}

.zb-badge-purple {
    background-color: var(--zb-primary-light);
    color: var(--zb-primary);
    border: 1px solid var(--zb-primary-border);
}

.zb-badge-muted {
    background-color: var(--zb-bg-muted);
    color: var(--zb-text-muted);
    border: 1px solid var(--zb-border);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: #ffffff;
    border-top: 1px solid var(--zb-border);
    z-index: 1040;
    padding: 0 0.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 991.98px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 100%;
    color: var(--zb-text-muted);
    font-size: 0.725rem;
    font-weight: 500;
    text-decoration: none;
    padding: 4px;
    min-height: var(--zb-touch-size);
}

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--zb-primary);
    font-weight: 700;
}

/* Touch targets and mobile usability */
button, .btn, input, select, textarea {
    font-family: var(--zb-font);
}

.btn-touch {
    min-height: var(--zb-touch-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: var(--zb-radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-zb-primary {
    background-color: var(--zb-primary);
    color: #ffffff;
    border: 1px solid var(--zb-primary);
}

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

.btn-zb-outline {
    background-color: transparent;
    color: var(--zb-navy);
    border: 1px solid var(--zb-border);
}

.btn-zb-outline:hover {
    background-color: var(--zb-bg-muted);
    border-color: var(--zb-border-hover);
}

/* Avatar Circle */
.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: var(--zb-radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: #ffffff;
    flex-shrink: 0;
}

/* Responsive Table */
.zb-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--zb-radius-md);
}

.zb-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.zb-table th {
    background-color: var(--zb-bg-muted);
    color: var(--zb-text-muted);
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--zb-border);
    white-space: nowrap;
}

.zb-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--zb-border);
    background-color: #ffffff;
    vertical-align: middle;
}

.zb-table tr:hover td {
    background-color: var(--zb-primary-light);
}

/* Modals */
.modal-backdrop.show {
    opacity: 0.6;
}

.modal-content {
    border-radius: var(--zb-radius-lg);
    border: 1px solid var(--zb-border);
    box-shadow: var(--zb-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--zb-border);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--zb-border);
    padding: 1rem 1.5rem;
}

/* Floating Action Button (FAB) for Mobile */
.zb-fab {
    position: fixed;
    bottom: 76px;
    left: 20px;
    width: 54px;
    height: 54px;
    border-radius: var(--zb-radius-full);
    background: linear-gradient(135deg, var(--zb-primary), #6d28d9);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    z-index: 1035;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.zb-fab:active {
    transform: scale(0.92);
}

@media (min-width: 992px) {
    .zb-fab {
        display: none;
    }
}

/* Print Styles */
@media print {
    .app-sidebar, .app-topbar, .mobile-bottom-nav, .btn, .no-print {
        display: none !important;
    }
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    body {
        background-color: #ffffff !important;
    }
}
