/* ============= ОБЩИЕ НАСТРОЙКИ ============= */
:root {
    --primary: #6a5acd;
    --primary-hover: #5a4abf;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --border: #ddd;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
}

/* Тёмная тема */
[data-theme="dark"] {
    --primary: #8a7bdf;
    --primary-hover: #9ca3fc;
    --bg: #1a1a2e;
    --card-bg: #16213e;
    --text: #e1e1e1;
    --border: #333;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 500;
}

/* ============= ПАНЕЛЬ ПОЛЬЗОВАТЕЛЯ ============= */
.user-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 5px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.user-panel span {
    font-size: 1rem;
    font-weight: 500;
}

.user-panel a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 15px;
    font-size: 0.95rem;
}

.user-panel a:hover {
    text-decoration: underline;
}

/* ============= УПРАВЛЕНИЕ ============= */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow);
    align-items: center;
}

.add-client {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.add-client input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
}

.add-client input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.2);
}

#addBtn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

#addBtn:hover {
    background: var(--primary-hover);
}

.actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.actions button,
.actions label {
    padding: 10px 15px;
    background: #f0f0f0;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.actions button:hover,
.actions label:hover {
    background: #e0e0e0;
    color: var(--primary);
}

/* ============= ФИЛЬТРЫ ============= */
.filters {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

#searchInput {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
}

.clear-btn {
    padding: 10px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* ============= KANBAN ДОСКА ============= */
.kanban-board {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.column {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--shadow);
    width: 320px;
    min-width: 280px;
    max-width: 350px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.column h2 {
    padding: 15px;
    margin: 0;
    background: var(--primary);
    color: white;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
}

.card-list {
    min-height: 100px;
    padding: 10px;
    flex: 1;
    overflow-y: auto;
}

.card {
    background: var(--bg);
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px var(--shadow);
    cursor: grab;
    position: relative;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.card:hover {
    box-shadow: 0 4px 12px var(--shadow);
}

.card .name {
    font-weight: 500;
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: var(--text);
}

.card .phone,
.card .email {
    font-size: 0.95rem;
    color: #555;
    margin: 4px 0;
}

.card .comment {
    font-size: 0.9rem;
    color: #666;
    margin: 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card .date {
    font-size: 0.8rem;
    color: #888;
}

.reminder-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ============= МОДАЛЬНОЕ ОКНО ============= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px var(--shadow);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    color: var(--primary);
    font-size: 1.3rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 1rem;
}

.modal-footer .save-comment {
    background: var(--primary);
    color: white;
}

.modal-footer .delete-client {
    background: var(--danger);
    color: white;
}

.modal-footer button:hover {
    opacity: 0.9;
}

/* ============= ФОРМА КОММЕНТАРИЯ ============= */
.comment-form {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
}

.comment-form textarea {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.comment-form .small-btn {
    align-self: flex-end;
    margin-top: 10px;
    padding: 8px 15px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* ============= НАПОМИНАНИЕ ============= */
.reminder-section {
    margin-top: 15px;
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    background: #f8f9ff;
}

.reminder-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.reminder-section input,
.reminder-section select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 100%;
    font-size: 1rem;
}

/* ============= СООБЩЕНИЯ ============= */
.message {
    padding: 12px;
    margin: 15px 0;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============= КНОПКИ ============= */
button {
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============= МОБИЛЬНАЯ АДАПТАЦИЯ ============= */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .controls,
    .filters,
    .actions,
    .add-client {
        flex-direction: column;
        align-items: stretch;
    }

    .actions {
        margin-left: 0;
    }

    .actions button,
    .actions label {
        justify-content: center;
    }

    .kanban-board {
        flex-direction: column;
        align-items: center;
    }

    .column {
        width: 100%;
        max-width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

/* Горизонтальный скролл для маленьких экранов (альтернатива) */
@media (max-width: 480px) {
    .kanban-board {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 20px;
    }

    .kanban-board::after {
        content: "";
        flex: 0 0 20px;
    }

    .column {
        display: inline-block;
        vertical-align: top;
        white-space: normal;
        min-width: 280px;
    }
}

/* ============= ПЕЧАТЬ ============= */
@media print {
    .user-panel,
    .controls,
    .filters,
    .actions,
    .modal,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .container {
        padding: 0;
    }

    .kanban-board {
        flex-direction: column;
    }

    .column {
        width: 100%;
        box-shadow: none;
        border: 1px solid #000;
    }

    .card {
        page-break-inside: avoid;
        border-left: 4px solid black;
    }
}
