/* ============ ПЕРЕМЕННЫЕ И ОБЩИЕ СТИЛИ ============ */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --banker-primary: #7c3aed;
    --banker-dark: #6d28d9;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============ ЭКРАНЫ ============ */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ============ АВТОРИЗАЦИЯ ============ */
#auth-screen {
    display: none;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#auth-screen.active {
    display: flex;
}

.auth-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.bank-logo {
    font-size: 64px;
    margin-bottom: 10px;
}

.auth-container h1 {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 24px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

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

.tab-btn:hover:not(.active) {
    border-color: var(--primary-color);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.error-message {
    color: var(--danger-color);
    margin-top: 15px;
    font-size: 14px;
}

/* ============ КНОПКИ ============ */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

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

.btn-success:hover {
    background: #16a34a;
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

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

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

/* ============ ЗАГОЛОВОК ============ */
.header {
    background: var(--primary-color);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.banker-header {
    background: var(--banker-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bank-icon {
    font-size: 32px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bank-day {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
}

/* ============ НАВИГАЦИЯ ============ */
.client-nav {
    background: white;
    padding: 15px 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.nav-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

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

.banker-nav .nav-btn.active {
    border-color: var(--banker-primary);
    background: var(--banker-primary);
}

.nav-btn:hover:not(.active) {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.banker-nav .nav-btn:hover:not(.active) {
    border-color: var(--banker-primary);
    background: rgba(124, 58, 237, 0.1);
}

/* ============ ОСНОВНОЙ КОНТЕНТ ============ */
.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section {
    display: none;
}

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

.content-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* ============ КАРТОЧКИ ============ */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    text-align: center;
    padding: 30px;
}

.card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.card-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

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

/* ============ СЧЕТА ============ */
.accounts-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.account-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
}

.account-number {
    font-family: monospace;
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 20px;
}

.account-balance {
    font-size: 32px;
    font-weight: 700;
}

.account-type {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 10px;
}

/* ============ ФОРМЫ ============ */
.inline-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form select,
.inline-form input {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
}

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

.hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

/* ============ ВЫБОР СРОКА ============ */
.term-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.term-option {
    display: block;
    cursor: pointer;
}

.term-option input {
    display: none;
}

.term-option span {
    display: block;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
}

.term-option input:checked + span {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.term-option.loan-term input:checked + span {
    border-color: var(--warning-color);
    background: var(--warning-color);
}

.term-option small {
    display: block;
    margin-top: 5px;
    opacity: 0.8;
}

/* ============ СПИСКИ ============ */
.deposits-list,
.loans-list,
.transactions-list,
.messages-list,
.clients-list,
.loan-requests-list,
.cash-requests-list,
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.list-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.list-item-info {
    flex: 1;
    min-width: 200px;
}

.list-item-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.list-item-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.list-item-value {
    font-size: 20px;
    font-weight: 700;
}

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

/* ============ СТАТУСЫ ============ */
.status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-paid {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

/* ============ ТРАНЗАКЦИИ ============ */
.transaction-item {
    padding: 15px;
}

.transaction-amount {
    font-weight: 700;
    font-size: 18px;
}

.transaction-amount.positive {
    color: var(--success-color);
}

.transaction-amount.negative {
    color: var(--danger-color);
}

/* ============ УПРАВЛЕНИЕ ДНЁМ ============ */
.day-control-card {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.current-day {
    margin-bottom: 30px;
}

.day-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.day-value {
    display: block;
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
}

.day-date {
    display: block;
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.day-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.day-effects {
    text-align: left;
    margin: 0 auto 30px;
    max-width: 300px;
    list-style: none;
}

.day-effects li {
    padding: 8px 0;
    font-size: 14px;
}

/* ============ МОДАЛЬНОЕ ОКНО ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* ============ УВЕДОМЛЕНИЯ (TOAST) ============ */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============ СООБЩЕНИЯ ============ */
.message-item {
    padding: 15px;
    border-left: 4px solid var(--primary-color);
}

.message-item.unread {
    background: rgba(37, 99, 235, 0.05);
}

.message-from {
    font-weight: 600;
    margin-bottom: 5px;
}

.message-text {
    margin-bottom: 10px;
}

.message-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============ КЛИЕНТЫ (ДЛЯ БАНКИРА) ============ */
.client-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.client-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.client-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.client-stat {
    text-align: center;
    padding: 10px;
    background: var(--background);
    border-radius: 8px;
}

.client-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.client-stat-value {
    font-size: 16px;
    font-weight: 600;
    margin-top: 5px;
}

/* ============ АДАПТИВНОСТЬ ============ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .client-nav {
        justify-content: center;
    }

    .main-content {
        padding: 15px;
    }

    .inline-form {
        flex-direction: column;
    }

    .inline-form select,
    .inline-form input,
    .inline-form button {
        width: 100%;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }

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

/* ============ ПУСТЫЕ СОСТОЯНИЯ ============ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

/* ============ ВКЛАДКИ СООБЩЕНИЙ ============ */
.messages-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.msg-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.msg-tab-btn:hover {
    color: var(--primary-color);
    background: rgba(66, 133, 244, 0.05);
}

.msg-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.msg-tab-content {
    display: none;
}

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

/* ============ СООБЩЕНИЯ ============ */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s;
}

.message-item.unread {
    background: #f0f7ff;
    border-left-color: var(--accent-color);
}

.message-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-sender {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.message-date {
    color: var(--text-secondary);
    font-size: 13px;
}

.message-subject {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 15px;
}

.message-body {
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.message-type-badge.incoming {
    background: #e8f5e9;
    color: #2e7d32;
}

.message-type-badge.outgoing {
    background: #e3f2fd;
    color: #1565c0;
}

/* ============ ПОИСК ПОЛУЧАТЕЛЕЙ ============ */
.search-results {
    position: relative;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-details {
    font-size: 13px;
    color: var(--text-secondary);
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* ============ КОНТАКТЫ ============ */
.contacts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.contact-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    border-left: 4px solid var(--success-color);
}

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

.contact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.contact-icon {
    font-size: 32px;
    margin-right: 12px;
}

.contact-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 4px;
}

.contact-username {
    color: var(--text-secondary);
    font-size: 13px;
}

.contact-account {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.contact-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.contact-actions button {
    flex: 1;
    padding: 8px;
    font-size: 13px;
}

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

.btn-send-money:hover {
    background: #43a047;
}

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

.btn-send-message:hover {
    background: #5a8dee;
}

.btn-delete-contact {
    background: var(--danger-color);
    flex: 0;
    padding: 8px 12px;
}

.btn-delete-contact:hover {
    background: #d32f2f;
}
