/* ============================================
   تیرادنت CRM - استایل اصلی
   پالت رنگی: آبی فیروزه‌ای + سرمه‌ای + سفید
   ============================================ */

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

:root {
    --primary: #00a8cc;
    --primary-dark: #0084a3;
    --navy: #1a2332;
    --navy-light: #2d3a4e;
    --bg: #f0f4f8;
    --white: #ffffff;
    --gray: #6c7a89;
    --gray-light: #e2e8f0;
    --green: #27ae60;
    --red: #e74c3c;
    --orange: #f39c12;
    --purple: #9b59b6;
    --sidebar-w: 260px;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background: var(--bg);
    color: var(--navy);
    font-size: 14px;
    line-height: 1.6;
}

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

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: var(--white);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,168,204,0.4);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--white);
}

.sidebar-header h2 .dent {
    font-size: 11px;
    color: var(--primary);
    letter-spacing: 4px;
    display: block;
    margin-top: -2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

.sidebar-nav a.active {
    background: rgba(0,168,204,0.15);
    border-right-color: var(--primary);
    color: var(--white);
}

.sidebar-nav a .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-nav .nav-section {
    padding: 15px 24px 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav .logout-link {
    color: rgba(231,76,60,0.8);
    margin-top: auto;
}

.sidebar-nav .logout-link:hover {
    background: rgba(231,76,60,0.1);
    color: var(--red);
}

/* ===== Notification Badge ===== */
.notif-badge {
    background: var(--red);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: auto;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Top Bar ===== */
.top-bar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .page-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
}

.top-bar .page-title p {
    font-size: 13px;
    color: var(--gray);
    margin-top: 2px;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .notif-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.2s;
}

.top-bar .notif-btn:hover { color: var(--primary); }

.top-bar .notif-btn .badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--red);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.top-bar .user-name {
    font-weight: 600;
    color: var(--navy);
}

.top-bar .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

/* ===== Content Area ===== */
.content-area {
    padding: 30px;
    flex: 1;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}

.stat-card .stat-trend {
    position: absolute;
    top: 22px;
    left: 22px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
}

.stat-trend.up { background: rgba(39,174,96,0.1); color: var(--green); }
.stat-trend.down { background: rgba(231,76,60,0.1); color: var(--red); }

/* ===== Tables ===== */
.table-container {
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-container h3 {
    padding: 20px 24px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--gray-light);
    color: var(--navy);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-light);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 13px;
    color: var(--navy);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: #f8fafc; }

.data-table .total-row {
    background: #f0f4f8;
    font-weight: 700;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.badge-new { background: var(--primary); }
.badge-contacted { background: var(--orange); }
.badge-visited { background: var(--purple); }
.badge-treatment { background: #1abc9c; }
.badge-won { background: var(--green); }
.badge-lost { background: var(--red); }
.badge-pending { background: var(--orange); }
.badge-collected { background: var(--green); }
.badge-bounced { background: var(--red); }
.badge-returned { background: var(--gray); }
.badge-cancelled { background: #95a5a6; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

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

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

.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-warning { background: var(--orange); color: white; }
.btn-secondary { background: var(--gray-light); color: var(--navy); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-light);
    color: var(--navy);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
}

.form-control, select, textarea, input[type="text"], input[type="password"],
input[type="email"], input[type="tel"], input[type="date"], input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--navy);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, select:focus, textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,168,204,0.1);
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0,168,204,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0,168,204,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    font-size: 32px;
    margin-bottom: 15px;
    box-shadow: 0 8px 20px rgba(0,168,204,0.3);
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--navy);
}

.login-logo h1 span {
    display: block;
    font-size: 12px;
    color: var(--primary);
    letter-spacing: 6px;
    margin-top: -2px;
}

.login-card .form-control {
    padding: 14px 16px;
    font-size: 15px;
}

.login-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 10px;
}

.login-error {
    background: rgba(231,76,60,0.08);
    color: var(--red);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid rgba(231,76,60,0.2);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 12px;
    color: var(--gray);
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fill-green { background: var(--green); }
.fill-red { background: var(--red); }
.fill-yellow { background: var(--orange); }
.fill-blue { background: var(--primary); }

/* ===== Progress Circle ===== */
.progress-circle {
    width: 80px;
    height: 80px;
    position: relative;
    display: inline-block;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle .bg-circle {
    fill: none;
    stroke: var(--gray-light);
    stroke-width: 8;
}

.progress-circle .fg-circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-circle .percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
}

/* ===== Funnel ===== */
.funnel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
}

.funnel-stage {
    width: 100%;
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    position: relative;
    transition: transform 0.2s;
}

.funnel-stage:hover { transform: scale(1.02); }

.funnel-stage .count {
    font-size: 24px;
    font-weight: 800;
}

.funnel-stage .label {
    font-size: 12px;
    opacity: 0.9;
}

.funnel-stage .rate {
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--gray);
    white-space: nowrap;
}

/* ===== Timeline ===== */
.timeline {
    list-style: none;
    padding: 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-light);
}

.timeline-item {
    position: relative;
    padding-right: 50px;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: 14px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item .timeline-content {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    padding: 12px 16px;
}

.timeline-item .timeline-content .title {
    font-weight: 600;
    font-size: 13px;
    color: var(--navy);
}

.timeline-item .timeline-content .desc {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

.timeline-item .timeline-content .time {
    font-size: 11px;
    color: var(--gray);
    margin-top: 6px;
}

/* ===== Responsive ===== */
.mobile-header {
    display: none;
    background: var(--navy);
    color: white;
    padding: 12px 20px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1100;
}

.mobile-header .menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .mobile-header {
        display: flex;
    }

    .mobile-header .logo-text {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 2px;
    }

    .content-area {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th, .data-table td {
        padding: 8px 10px;
    }

    .top-bar {
        padding: 12px 15px;
    }

    .top-bar .page-title h1 {
        font-size: 18px;
    }
}

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

    .login-card {
        padding: 30px 20px;
        margin: 15px;
    }
}