/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

/* Modal Content */
.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 15px 30px;
    flex-shrink: 0;
}

.modal-header h2 {
    color: #667eea;
    font-size: 22px;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

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

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 30px 25px 30px;
    flex-shrink: 0;
}

/* Buttons */
.btn-cancel {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-save {
    padding: 10px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-save:hover {
    background: #5568d3;
}

.btn-danger {
    padding: 10px 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* Form */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 17px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* View Modal */
.view-modal-body {
    user-select: text;
    -webkit-user-select: text;
}

.view-field {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.view-field:last-of-type {
    border-bottom: none;
}

.view-field-label {
    font-size: 15px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.view-field-value {
    font-size: 17px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
}

.view-field-value a {
    color: #667eea;
    text-decoration: none;
}

.view-field-value a:hover {
    text-decoration: underline;
}

.view-field-comments {
    white-space: pre-wrap;
}

.view-field-url {
    font-size: 13px;
    color: #667eea;
    word-break: break-all;
}

.view-field-row {
    display: flex;
    gap: 20px;
}

.view-field-row .view-field {
    flex: 1;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.status-badge.status-created { background: #e8f5e9; color: #2e7d32; }
.status-badge.status-hr_interview { background: #e3f2fd; color: #1565c0; }
.status-badge.status-tech_interview { background: #f3e5f5; color: #6a1b9a; }
.status-badge.status-offer { background: #fff3e0; color: #e65100; }
.status-badge.status-auto_reject { background: #fbe9e7; color: #bf360c; }
.status-badge.status-rejected { background: #ffebee; color: #c62828; }
.status-badge.status-ignored { background: #eceff1; color: #546e7a; }

/* View field status (читалка заявки) */
.view-field-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    background: #f0f0f0;
    color: #555;
}

.view-field-status.status-created { background: #e8f5e9; color: #2e7d32; }
.view-field-status.status-hr_interview { background: #e3f2fd; color: #1565c0; }
.view-field-status.status-tech_interview { background: #f3e5f5; color: #6a1b9a; }
.view-field-status.status-offer { background: #fff3e0; color: #e65100; }
.view-field-status.status-auto_reject { background: #fbe9e7; color: #bf360c; }
.view-field-status.status-rejected { background: #ffebee; color: #c62828; }
.view-field-status.status-ignored { background: #eceff1; color: #546e7a; }

/* Links */
.vacancy-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

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

/* Status History */
.history-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #e0e0e0;
}

.history-title {
    font-size: 15px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #f8f9fa;
    transition: background 0.2s;
}

.history-entry:hover {
    background: #f0f0f0;
}

.history-entry.is-current {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

.history-entry-date {
    font-size: 13px;
    color: #888;
    min-width: 80px;
}

.history-entry-status {
    flex: 1;
    margin-left: 12px;
    font-size: 14px;
    font-weight: 500;
}

.history-entry-current-label {
    font-size: 11px;
    color: #2e7d32;
    font-weight: 600;
    margin-left: 8px;
}

.history-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    color: #ccc;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    opacity: 0;
}

.history-entry:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

#history-loading {
    font-size: 14px;
    color: #999;
    text-align: center;
    padding: 20px;
}

.history-error {
    font-size: 13px;
    color: #e74c3c;
    margin-top: 8px;
    padding: 8px 12px;
    background: #ffebee;
    border-radius: 6px;
    display: none;
}

/* Increased spacing for confirmation modal headings */
#logout-modal .modal-header h2,
#delete-modal .modal-header h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 0;
}

/* Auto-ignore modal: match other confirmation modals */
#auto-ignore-modal .modal-header h2 {
    color: #333;
    font-size: 24px;
}

.auto-ignore-modal-body {
    font-size: 18px;
    color: #333;
}

/* Logout, Delete & Auto-ignore modal extra spacing */
.logout-modal-body,
.delete-modal-body,
.auto-ignore-modal-body {
    font-size: 18px;
    color: #333;
}

.warning {
    font-size: 15px;
    color: #e74c3c;
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        max-width: 95%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 15px;
        padding-right: 15px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }

    .view-field-row {
        flex-direction: column;
        gap: 0;
    }
}
