/* web_app/static/css/contacts.css */

/* Панель поиска и кнопка добавления */
.contacts-toolbar {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.contacts-toolbar .contact-search {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: white;
}

.contacts-toolbar .contact-search:focus {
    border-color: #667eea;
}

.btn-add-contact {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.btn-add-contact:hover {
    background: #5a6fd6;
}

/* Сетка контактов */
.contacts-grid {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.contact-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.contact-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 150px;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.contact-details {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 14px;
    color: #666;
}

.contact-phone, .contact-org, .contact-notes {
    display: flex;
    align-items: center;
    gap: 4px;
}

.contact-delegate-status {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 12px;
}

.delegate-ok {
    background: #e8f5e9;
    color: #2ecc71;
}

.delegate-no {
    background: #ffebee;
    color: #e74c3c;
}

.contact-actions {
    display: flex;
    gap: 6px;
}

.contact-actions button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: #f0f2f5;
    color: #555;
}

.contact-actions .btn-edit:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.contact-actions .btn-delete:hover {
    background: #ffebee;
    color: #e74c3c;
}

/* Модальное окно */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-box h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
}

.modal-box .form-group {
    margin-bottom: 12px;
}

.modal-box label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.modal-box input, .modal-box textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.modal-box input:focus, .modal-box textarea:focus {
    border-color: #667eea;
}

.modal-box textarea {
    resize: vertical;
    min-height: 60px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-modal-cancel {
    background: #f0f2f5;
    color: #666;
}

.btn-modal-cancel:hover {
    background: #e0e0e0;
}

.btn-modal-save {
    background: #667eea;
    color: white;
}

.btn-modal-save:hover {
    background: #5a6fd6;
}

[data-theme="dark"] .contact-card {
    background: var(--surface-card);
    border-color: var(--border);
}

[data-theme="dark"] .contact-name {
    color: var(--text);
}

[data-theme="dark"] .contact-details {
    color: var(--text-secondary);
}

[data-theme="dark"] .contacts-toolbar {
    background: var(--bg);
    border-color: var(--border);
}

[data-theme="dark"] .contact-search {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .modal-box {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

[data-theme="dark"] .modal-box h3 {
    color: var(--text);
}

[data-theme="dark"] .modal-box label {
    color: var(--text-secondary);
}

[data-theme="dark"] .modal-box input,
[data-theme="dark"] .modal-box textarea {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
}

/* Адаптивность */
@media (max-width: 600px) {
    .contact-card {
        flex-direction: column;
        align-items: stretch;
    }
    .contact-header {
        min-width: auto;
    }
    .contact-actions {
        justify-content: flex-end;
    }
}
