/* Основные стили */
:root {
    --primary-color: #1E5EFF;
    --secondary-color: #6C7293;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --bg-color: #F5F7FA;
    --sidebar-bg: #FFFFFF;
    --sidebar-width: 200px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --border-color: #E5E7EB;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.6;
}

/* Toast уведомления */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: #10b981;
    color: white;
    border-left: 4px solid #059669;
}

.alert-error {
    background: #ef4444;
    color: white;
    border-left: 4px solid #dc2626;
}

.alert::before {
    content: '✓';
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.alert-error::before {
    content: '✕';
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.alert.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Стили для ссылок на номера телефонов */
a[href^="tel:"],
.phone-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a[href^="tel:"]:hover,
.phone-link:hover {
    color: var(--info-color);
    text-decoration: none;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn span {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 15px 10px;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
}

.sidebar.collapsed .user-avatar {
    margin-right: 0;
}

.sidebar.collapsed .logout-btn {
    justify-content: center;
}

.sidebar.collapsed .logout-btn i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-toggle {
    right: -16px;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.sidebar-toggle {
    position: absolute;
    top: calc(var(--header-height) / 2);
    right: -16px;
    transform: translateY(-50%);
    background: white;
    color: var(--text-light);
    border: 2px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.sidebar-toggle i {
    font-size: 12px;
}

.logo-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    text-align: center;
    animation: coinFlip 3s ease-in-out infinite;
}

.logo-circle.no-animation {
    animation: none;
}

.logo-circle img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-compact {
    width: 50px;
    height: 50px;
    font-size: 20px;
    font-weight: 700;
}

@keyframes coinFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake-animation {
    animation: shake 0.5s;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item i {
    font-size: 20px;
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(30, 94, 255, 0.05);
    color: var(--primary-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    border-radius: 12px;
    margin: 0 10px;
}

.nav-item.active i {
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 10px;
    flex-shrink: 0;
}

.user-avatar i {
    font-size: 18px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 13px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-role {
    font-size: 11px;
    color: var(--text-light);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.logout-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    text-decoration: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Header */
.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-small {
    width: 35px;
    height: 35px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 15px 20px;
    overflow-y: auto;
}

/* Flash Messages */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    animation: slideDown 0.3s ease;
}

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

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info-color);
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Горизонтальное отображение для страницы корзины */
.stats-cards .stat-card {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-icon.bg-blue { background: var(--primary-color); }
.stat-icon.bg-green { background: var(--success-color); }
.stat-icon.bg-orange { background: var(--warning-color); }
.stat-icon.bg-purple { background: #8B5CF6; }
.stat-icon.bg-red { background: var(--danger-color); }

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

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.4;
}

/* Stat Breakdown */
.stat-breakdown {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.stat-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
}

.stat-breakdown-item:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

.breakdown-label {
    color: var(--text-dark);
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakdown-label i {
    font-size: 13px;
    color: var(--text-light);
}

.breakdown-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
    margin-left: 10px;
}

.stat-card-detailed {
    grid-column: span 1;
}

/* Stats Row Three */
.stats-row-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

/* Managers Stats Card */
.managers-stats-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.managers-stats-header {
    margin-bottom: 20px;
}

.managers-stats-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.managers-stats-table {
    overflow-x: auto;
}

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

.managers-stats-table thead {
    background: #f8f9fa;
}

.managers-stats-table th {
    padding: 12px;
    text-align: left;
    font-size: 8px;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 45px;
    vertical-align: middle;
    box-sizing: border-box;
    line-height: 1.2;
}

.managers-stats-table th i {
    font-size: 14px;
    color: var(--text-light);
}

.managers-stats-table td {
    padding: 12px;
    font-size: 14px;
    color: var(--text-dark);
    border-bottom: 1px solid #f3f4f6;
    height: 50px;
    vertical-align: middle;
    box-sizing: border-box;
    line-height: 1;
}

.managers-stats-table td:first-child strong {
    font-weight: 500;
    font-size: 13px;
}

.managers-stats-table td:first-child strong i {
    font-size: 13px;
    color: var(--text-light);
    margin-right: 8px;
}

.managers-stats-table tbody tr:hover {
    background: #f8f9fa;
}

.managers-stats-table tbody tr:last-child td {
    border-bottom: none;
}

/* Analytics Filter Button in Header */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.analytics-filter-btn {
    padding: 8px 16px;
    font-size: 14px;
}

.analytics-filter-btn .btn-text {
    margin-left: 8px;
}

/* Period Filter Modal */
.period-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.period-form .form-group {
    flex: 1;
    min-width: 150px;
}

.period-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.period-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.period-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
    width: 100%;
    flex-basis: 100%;
}

.period-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: 0;
}

.period-divider span {
    background: white;
    padding: 0 15px;
    color: var(--text-light);
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.quick-period-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.period-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.period-btn:hover {
    background: #e5e7eb;
    border-color: var(--primary-color);
}

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

/* Period Title */
.period-title {
    margin-bottom: 20px;
}

.period-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.period-detail {
    color: var(--text-light);
    font-weight: 500;
    font-size: 16px;
}

/* Period Stats */
.period-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.period-card {
    background: white;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.period-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.period-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Managers Stats */
.managers-stats {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.managers-stats h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-dark);
    font-weight: 600;
}

.managers-table {
    overflow-x: auto;
}

.managers-table table th {
    white-space: nowrap;
    font-size: 12px;
}

.managers-table table td {
    white-space: nowrap;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--bg-color);
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

table tbody tr:hover {
    background: rgba(30, 94, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-green {
    background: #D1FAE5;
    color: #065F46;
}

.badge-orange {
    background: #FED7AA;
    color: #92400E;
}

.badge-purple {
    background: #E9D5FF;
    color: #5B21B6;
}

.badge-red {
    background: #FEE2E2;
    color: #DC2626;
    font-weight: 600;
}

/* Leads Page */
.filters-bar {
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--bg-color);
}

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

.test-sound-btn {
    padding: 8px 16px;
    border: 1px solid #10B981;
    background: #10B981;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.test-sound-btn:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.leads-table-container {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.phone-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline;
}

.phone-link:hover {
    text-decoration: underline;
}

.phone-masked {
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-form {
    display: inline;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn .btn-text-mobile {
    display: none;
}

.btn .btn-text-desktop {
    display: inline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.btn-primary:hover {
    background: #1651E0;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

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

.btn-info:hover {
    background: #2563EB;
}

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

.btn-secondary:hover {
    background: #5A5F7D;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: 300;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

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

/* Settings Page */
.settings-container {
    max-width: 900px;
}

.settings-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-section h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-dark);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.settings-form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

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

.api-info {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
}

.api-url {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.api-url code {
    flex: 1;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

pre {
    background: white;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
}

.mb-3 {
    margin-bottom: 20px;
}

.mt-3 {
    margin-top: 20px;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366F1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.logo-circle-large {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.3;
}

.logo-circle-large img {
    height: 120px !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
}

.login-header h1 {
    display: none;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form {
    margin-bottom: 25px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
}

.login-form label i {
    color: var(--primary-color);
}

.login-info {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}

.login-info p {
    margin: 5px 0;
}

.login-info strong {
    color: var(--text-dark);
}

/* Мобильное меню */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
}

/* Кнопка фильтра для мобильных */
.mobile-filter-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.mobile-filter-toggle:active {
    transform: scale(0.98);
}

.mobile-filter-toggle i {
    margin-right: 8px;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Скрываем текст "принятия:" и "обработки:" в десктопной версии */
.time-label {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .mobile-filter-toggle {
        display: block;
    }
    
    .filters-bar {
        display: none;
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 15px;
    }
    
    .filters-bar.show {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body.mobile-menu-active {
        overflow: hidden;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        width: 100%;
    }
    
    .header {
        padding: 0 15px;
    }
    
    .header-left {
        display: flex;
        align-items: center;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .header-user span {
        display: none;
    }
    
    .page-content {
        padding: 15px;
    }
    
    /* Адаптация таблицы заявок */
    .leads-table-container {
        overflow-x: auto;
    }
    
    .leads-table {
        display: block;
    }
    
    .leads-table thead {
        display: none;
    }
    
    .leads-table tbody {
        display: block;
    }
    
    .leads-table tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 15px;
        background: white;
        border-radius: 12px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .leads-table td {
        display: block;
        padding: 8px 0;
        border: none;
        text-align: left;
        width: 100%;
    }
    
    .leads-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 10px;
        color: var(--text-light);
        min-width: 120px;
    }
    
    /* Порядок: Статус, Дата */
    .leads-table td[data-label="Статус:"] {
        order: 1;
        width: 50%;
        padding-right: 5px;
        display: flex;
        align-items: center;
    }
    
    .leads-table td[data-label="Дата:"] {
        order: 2;
        width: 50%;
        padding-left: 5px;
        display: flex;
        align-items: center;
    }
    
    /* Порядок: Телефон, Описание */
    .leads-table td[data-label="Телефон:"] {
        order: 3;
        width: 50%;
        padding-right: 5px;
        display: flex;
        align-items: center;
    }
    
    .leads-table td[data-label="Описание:"] {
        order: 4;
        width: 50%;
        padding-left: 5px;
        display: flex;
        align-items: center;
    }
    
    /* Время принятия и обработки в одну строку */
    .leads-table td[data-label="принятия:"] {
        order: 5;
        width: 50%;
        padding-right: 5px;
        font-size: 14px;
        font-weight: 500;
        display: flex;
        align-items: center;
    }
    
    .leads-table td[data-label="обработки:"] {
        order: 6;
        width: 50%;
        padding-left: 5px;
        font-size: 14px;
        font-weight: 500;
        display: flex;
        align-items: center;
    }
    
    /* Стиль для иконки часов */
    .leads-table td[data-label="принятия:"] i,
    .leads-table td[data-label="обработки:"] i {
        margin-right: 5px;
        font-size: 14px;
    }
    
    /* Стиль для текста "принятия:" и "обработки:" */
    .leads-table td[data-label="принятия:"] .time-label,
    .leads-table td[data-label="обработки:"] .time-label {
        display: inline;
        font-size: 14px;
        font-weight: 500;
        margin-right: 5px;
    }
    
    /* Стиль для значения времени */
    .leads-table td[data-label="принятия:"] .time-value,
    .leads-table td[data-label="обработки:"] .time-value {
        font-size: 14px;
        font-weight: 500;
    }
    
    .leads-table td[data-label="Менеджер:"] {
        order: 7;
    }
    
    /* Иконка для даты */
    .leads-table td[data-label="Дата:"]::before {
        content: "\f017";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        min-width: auto;
        margin-right: 8px;
    }
    
    /* Скрываем лейблы */
    .leads-table td[data-label="Телефон:"]::before,
    .leads-table td[data-label="Описание:"]::before,
    .leads-table td[data-label="Статус:"]::before,
    .leads-table td[data-label="принятия:"]::before,
    .leads-table td[data-label="обработки:"]::before {
        display: none;
    }
    
    /* Скрываем иконку телефона */
    .leads-table td[data-label="Телефон:"] i {
        display: none;
    }
    
    .actions-cell {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 12px !important;
        border-top: 1px solid var(--border-color);
        margin-top: 8px;
        order: 100;
        width: 100%;
    }
    
    .actions-cell::before {
        content: none !important;
    }
    
    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    
    .action-buttons .action-form {
        display: contents;
    }
    
    .action-buttons .btn {
        justify-content: center;
        width: 100%;
    }
    
    /* Показываем текст на кнопках */
    .action-buttons .btn .btn-text-mobile {
        display: inline;
        margin-left: 8px;
    }
    
    /* Скрываем "Есть комментарий" */
    .leads-table td small {
        display: none;
    }
    
    /* Адаптация фильтров */
    .filter-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    /* Адаптация модальных окон */
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
    }
    
    /* Адаптация формы фильтра периода */
    .period-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-form .form-group {
        width: 100%;
        min-width: 100%;
    }
    
    .period-form .form-control {
        font-size: 16px;
    }
    
    /* Показываем мобильный текст на кнопках */
    .btn .btn-text-mobile {
        display: inline;
    }
    
    .btn .btn-text-desktop {
        display: none;
    }
    
    /* Адаптация кнопки фильтра */
    .analytics-filter-btn {
        margin-left: 10px;
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .analytics-filter-btn .btn-text {
        display: none;
    }
    
    /* Адаптация кнопок быстрого периода в модальном окне */
    .quick-period-buttons {
        flex-direction: column;
    }
    
    .period-btn {
        text-align: center;
        width: 100%;
    }
    
    /* Адаптация заголовка периода */
    .period-title h2 {
        font-size: 16px;
    }
    
    .period-detail {
        font-size: 14px;
        display: block;
        margin-top: 5px;
    }
    
    /* Адаптация блока статистики */
    .stat-card-detailed {
        grid-column: span 1;
    }
    
    /* Адаптация блока статистики менеджеров */
    .stats-row-three {
        grid-template-columns: 1fr;
    }
    
    .managers-stats-card {
        padding: 15px;
    }
    
    .managers-stats-header h3 {
        font-size: 16px;
    }
    
    .managers-stats-table {
        font-size: 13px;
    }
    
    .managers-stats-table th,
    .managers-stats-table td {
        padding: 8px;
        font-size: 12px;
    }
    
    /* Адаптация статистики */
    .period-stats {
        grid-template-columns: 1fr;
    }
    
    /* Адаптация таблицы менеджеров */
    .managers-stats {
        padding: 15px;
    }
    
    .managers-stats h2 {
        font-size: 18px;
    }
    
    .managers-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .managers-table table {
        min-width: 800px;
    }
    
    .managers-table table th,
    .managers-table table td {
        font-size: 11px;
        padding: 10px 8px;
    }
    
    /* Адаптация пагинации */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination a,
    .pagination span {
        min-width: 40px;
        text-align: center;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

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

.modal-header {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close,
.close-modal {
    font-size: 28px;
    font-weight: 300;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
}

.modal-close:hover,
.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-lead-name {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.modal-lead-name strong {
    color: var(--primary-color);
}

.modal-body .form-group {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 94, 255, 0.1);
}

.modal-body small {
    display: block;
    margin-top: 8px;
    color: var(--text-light);
    font-size: 13px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: white;
}

.modal-footer .btn {
    padding: 10px 20px;
}

.notes-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--info-color);
}

.notes-content p {
    margin: 0;
    color: var(--text-dark);
}

/* Форма добавления менеджера */
.manager-form-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.manager-form-container .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.manager-form-container .form-group {
    margin-bottom: 0;
}

.manager-form-container .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.manager-form-container .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.manager-form-container .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 94, 255, 0.1);
}

/* Группа ввода пароля с кнопками */
.password-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.password-input-group .form-control {
    flex: 1;
}

.password-input-group .btn-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.password-input-group .btn-icon:hover {
    background: #1348d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 94, 255, 0.3);
}

.password-input-group .btn-icon:active {
    transform: translateY(0);
}

/* Кнопки формы */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.form-actions .btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.form-actions .btn-primary:hover {
    background: #1348d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 94, 255, 0.3);
}

.form-actions .btn-secondary {
    background: #6C757D;
    color: white;
}

.form-actions .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.form-actions .btn:active {
    transform: translateY(0);
}

/* Кнопки действий в таблице */
.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-sm.btn-primary:hover {
    background: #1348d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 94, 255, 0.3);
}

/* Улучшенные стили модального окна для форм */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Стили для описания заявки */
.description-details {
    padding: 20px;
}

.detail-row {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-row strong {
    color: var(--primary-color);
    display: inline;
}

/* Animation for new leads */
.new-lead-animation {
    animation: slideInFromLeft 0.5s ease-out;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Highlight effect for new lead */
.lead-highlight {
    background-color: #FEF3C7 !important;
    transition: background-color 2s ease;
}

/* Pulse animation for unprocessed indicator */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

