:root {
    --teal-primary: #0E9496;
    --teal-secondary: #0DA5A8;
    --teal-light: #E6F3F3;
    --gray-dark: #2D3748;
    --gray-medium: #4A5568;
    --gray-light: #F5F7F9;
    --gray-border: #E2E8F0;
    --black: #1A202C;
    --white: #FFFFFF;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-light);
    color: var(--gray-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--teal-primary), var(--teal-secondary));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: var(--white);
    border-bottom: 2px solid var(--teal-light);
    margin-bottom: 1.5rem;
    border-radius: 8px 8px 0 0;
    overflow-x: auto;
}

.nav-tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-medium);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--teal-primary);
    background: var(--teal-light);
}

.nav-tab.active {
    color: var(--teal-primary);
    border-bottom-color: var(--teal-primary);
    background: var(--teal-light);
}

.tab-content {
    display: none;
}

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

/* Login Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--teal-primary), var(--teal-secondary));
    padding: 20px;
}

.login-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--teal-primary);
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-border);
    border-radius: 5px;
    font-size: 1rem;
}

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

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--teal-secondary);
}

.btn-secondary {
    background-color: var(--gray-light);
    color: var(--gray-dark);
    border: 1px solid var(--gray-border);
}

.btn-secondary:hover {
    background-color: var(--gray-border);
}

.btn-success {
    background-color: #48BB78;
    color: white;
}

.btn-danger {
    background-color: #F56565;
    color: white;
}

.btn-warning {
    background-color: #ED8936;
    color: white;
}

.btn-info {
    background-color: #4299E1;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    padding: 1rem 0;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Dashboard Styles */
.dashboard {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard h2 {
    color: var(--teal-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.agents-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.agent-card {
    background: var(--teal-light);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--teal-primary);
}

.agent-name {
    font-weight: bold;
    color: var(--teal-primary);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.agent-stats {
    font-size: 0.9rem;
    color: var(--gray-medium);
}

.contract-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--teal-primary);
}

/* Admin Panel Styles */
.admin-section {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-section h3 {
    color: var(--teal-primary);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.reference-table th,
.reference-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-border);
    word-wrap: break-word;
}

.reference-table th {
    background-color: var(--teal-light);
    font-weight: 600;
    color: var(--teal-primary);
}

.danger-zone {
    border: 2px solid #F56565;
    background: #FED7D7;
}

.danger-zone h3 {
    color: #C53030;
}

/* Table Styles */
.table-container {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 2rem;
}

.mobile-table {
    display: none;
}

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

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-border);
    word-wrap: break-word;
    word-break: break-word;
}

th {
    background-color: var(--teal-light);
    font-weight: 600;
    color: var(--teal-primary);
    font-size: 0.9rem;
}

td {
    font-size: 0.875rem;
}

tr:hover {
    background-color: var(--gray-light);
}

.actions {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

/* Mobile Table Styles */
.mobile-contract-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mobile-contract-header {
    display: flex;
    justify-content: between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.mobile-contract-number {
    font-weight: bold;
    color: var(--teal-primary);
    font-size: 0.9rem;
}

.mobile-contract-date {
    color: var(--gray-medium);
    font-size: 0.8rem;
}

.mobile-contract-details {
    margin-bottom: 0.75rem;
}

.mobile-detail-row {
    display: flex;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.mobile-detail-label {
    font-weight: 500;
    color: var(--gray-medium);
    min-width: 80px;
    margin-right: 0.5rem;
}

.mobile-detail-value {
    color: var(--gray-dark);
    flex: 1;
    word-break: break-word;
}

.mobile-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-border);
    padding-top: 0.75rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: var(--teal-primary);
    font-size: 1.3rem;
}

.close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-medium);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.contract-preview {
    background: linear-gradient(135deg, #0E9496, #0DA5A8);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    border: 2px dashed rgba(255,255,255,0.3);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.file-input {
    display: none;
}

.file-input-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--teal-light);
    color: var(--teal-primary);
    border: 1px dashed var(--teal-primary);
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.file-input-label:hover {
    background-color: var(--teal-primary);
    color: var(--white);
}

/* Additional client styles */
.client-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.client-row:focus-within {
    transform: translateX(5px);
}

.client-input {
    flex: 1;
}

.remove-client {
    background: #F56565;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-client:hover {
    background: #E53E3E;
    transform: scale(1.1);
}

.add-client-btn {
    background: var(--teal-light);
    color: var(--teal-primary);
    border: 1px dashed var(--teal-primary);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    color: var(--white);
    background-color: #48BB78;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1100;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 300px;
    word-break: break-word;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background-color: #F56565;
}

/* Стили для расширенной статистики */
.extended-stats-section {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-top: 2rem;
}

.stats-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.period-controls {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.period-controls .form-group {
    margin-bottom: 0;
}

.period-controls label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

.period-info {
    background: var(--teal-light);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    color: var(--teal-primary);
    font-weight: 500;
}

.total-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.total-stat-card {
    background: var(--teal-light);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--teal-primary);
    transition: transform 0.2s ease;
}

.total-stat-card:hover {
    transform: translateY(-2px);
}

.total-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--teal-primary);
    margin-bottom: 0.5rem;
}

.total-stat-label {
    font-size: 0.9rem;
    color: var(--gray-medium);
    font-weight: 500;
}

.extended-stats-table {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--gray-border);
}

.extended-stats-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.extended-stats-table th {
    background: var(--teal-light);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--teal-primary);
    border-bottom: 2px solid var(--teal-primary);
}

.extended-stats-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-border);
}

.extended-stats-table .agent-name {
    font-weight: 500;
    color: var(--teal-primary);
}

.extended-stats-table .stat-value {
    text-align: center;
    font-weight: bold;
    color: var(--gray-dark);
}

.extended-stats-table tr:hover {
    background-color: var(--gray-light);
}

.basic-stats {
    margin-bottom: 2rem;
}

.basic-stats h3 {
    color: var(--teal-primary);
    margin-bottom: 1rem;
}

/* Стили для улучшенной индикации сохранения */
.btn-saving {
    background-color: #a0aec0 !important;
    color: white !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-primary:active:after {
    width: 100px;
    height: 100px;
}

/* Улучшенные уведомления */
.advanced-notification {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255,255,255,0.7);
    width: 100%;
    transform: scaleX(1);
    transform-origin: left;
    transition: transform linear;
}

/* Анимация появления модального окна */
.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Анимация успешного сохранения */
.contract-saved-indicator {
    background-color: #48bb78;
    color: white;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin: 10px 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.success-checkmark {
    color: #48bb78;
    font-size: 2rem;
    text-align: center;
    margin: 10px 0;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* Стили для контейнера с зависимыми секциями */
#experience-sections-container {
    margin: 40px 0 30px;
    padding: 20px 0 0;
    border-top: 2px dashed #0E9496;
    position: relative;
}

#experience-sections-container:before {
    content: '📋 Дополнительные вопросы';
    position: absolute;
    top: -12px;
    left: 30px;
    background: white;
    padding: 0 20px;
    color: #0E9496;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Анимация для появления секций */
#beginner-section,
#experienced-section {
    transition: all 0.4s ease;
    margin-bottom: 0;
}

#beginner-section:last-child,
#experienced-section:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .user-info {
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .nav-tab {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .filters, .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .filters .form-control,
    .action-buttons .btn {
        width: 100%;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .agents-stats {
        grid-template-columns: 1fr;
    }

    .agent-card {
        padding: 0.75rem;
    }

    /* Hide desktop table on mobile */
    .desktop-table {
        display: none;
    }

    .mobile-table {
        display: block;
    }

    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem;
    }

    .modal-content {
        padding: 1rem;
        margin: 10px;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .reference-table {
        font-size: 0.8rem;
    }

    .reference-table th,
    .reference-table td {
        padding: 0.5rem;
    }

    .client-row {
        flex-direction: column;
        align-items: stretch;
    }

    .remove-client {
        align-self: flex-end;
    }

    /* Адаптивность для расширенной статистики */
    .stats-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-controls {
        flex-direction: column;
    }
    
    .period-controls .form-group {
        width: 100%;
    }
    
    .total-stats {
        grid-template-columns: 1fr;
    }
    
    .extended-stats-table {
        font-size: 0.8rem;
    }
    
    .extended-stats-table th,
    .extended-stats-table td {
        padding: 0.5rem;
    }

    /* Адаптивность для улучшенных уведомлений */
    .btn-saving {
        padding: 1rem !important;
        font-size: 1.1rem !important;
    }
    
    .advanced-notification {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .contract-preview {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1rem;
    }

    .login-card h2 {
        font-size: 1.3rem;
    }

    .dashboard {
        padding: 1rem;
    }

    .mobile-contract-card {
        padding: 0.75rem;
    }

    .mobile-actions {
        flex-direction: column;
    }

    .mobile-actions .btn {
        width: 100%;
    }

    .admin-section {
        padding: 1rem;
    }
}

/* Добавьте в style.css */
.form-control:disabled {
    background-color: var(--gray-light);
    color: var(--gray-medium);
    cursor: not-allowed;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}