/* Modal styles - Modal overlay, content, and global mobile responsive adjustments */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .modal-content {
    background: #2a2a2a;
}

.modal-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

body.dark-mode .modal-header {
    color: #e0e0e0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    padding: 10px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

.btn-save {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-save:hover {
    background: #229954;
}

.modal-info {
    font-size: 13px;
    color: #888;
    margin-bottom: 15px;
}

body.dark-mode .modal-info {
    color: #999;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
    }

    .header-controls {
        gap: 6px;
    }

    .logout-btn {
        padding: 4px 8px;
        font-size: 9px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 18px;
        padding: 4px;
    }

    .header-link {
        padding: 6px 10px;
        font-size: 0;
    }

    .header-link .link-icon {
        font-size: 18px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }

    .health-grid {
        grid-template-columns: 1fr;
    }

    .waveform-container {
        height: 100px;
    }

    .monitor-settings {
        padding: 10px;
    }
}

/* ============================================
   Email Modal Styles
   ============================================ */

.modal-email {
    max-width: 550px;
}

.modal-email textarea {
    resize: vertical;
    max-height: 200px;
    min-height: 100px;
    width: 100%;
    box-sizing: border-box;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    float: right;
    line-height: 1;
    padding: 0;
    margin-top: -5px;
}

body.dark-mode .btn-close-modal {
    color: #999;
}

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

body.dark-mode .btn-close-modal:hover {
    color: #e0e0e0;
}

.email-recording-info {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

body.dark-mode .email-recording-info {
    background: #1a1a1a;
}

.email-recording-info strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

body.dark-mode .email-recording-info strong {
    color: #e0e0e0;
}

.email-recording-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}

body.dark-mode .email-recording-meta {
    color: #999;
}

.email-from-input {
    background: #f0f0f0 !important;
    color: #666 !important;
    cursor: not-allowed;
}

body.dark-mode .email-from-input {
    background: #333 !important;
    color: #999 !important;
}

.email-recipients {
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
}

body.dark-mode .email-recipients {
    border-color: #444;
    background: #1a1a1a;
}

.email-recipient-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

body.dark-mode .email-recipient-checkbox {
    color: #e0e0e0;
}

.email-recipient-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.email-recipient-email {
    color: #888;
    font-size: 12px;
}

body.dark-mode .email-recipient-email {
    color: #666;
}

.email-manual-entry {
    display: flex;
    gap: 8px;
}

.email-manual-entry input {
    flex: 1;
}

.btn-add-email {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-add-email:hover {
    background: #2980b9;
}

.email-additional-list {
    margin-top: 10px;
}

.email-additional-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #e8f4f8;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 13px;
    color: #333;
}

body.dark-mode .email-additional-item {
    background: #1a2a3a;
    color: #e0e0e0;
}

.btn-remove-email {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.btn-remove-email:hover {
    color: #c0392b;
}

.btn-send {
    padding: 10px 24px;
    background: #16a085;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.btn-send:hover {
    background: #138d75;
}

.btn-send:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.email-sending {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: #f0f9ff;
    border-radius: 6px;
    margin-top: 15px;
    color: #3498db;
}

body.dark-mode .email-sending {
    background: #1a2a3a;
}

.email-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: email-spin 1s linear infinite;
}

@keyframes email-spin {
    to { transform: rotate(360deg); }
}

.email-error {
    padding: 12px;
    background: #fef0f0;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    color: #c0392b;
    margin-top: 15px;
    font-size: 14px;
}

body.dark-mode .email-error {
    background: #2a1a1a;
    border-color: #c0392b;
}

/* User email display in admin */
.user-email {
    font-size: 12px;
    color: #3498db;
}

body.dark-mode .user-email {
    color: #5dade2;
}

.user-email.no-email {
    color: #999;
    font-style: italic;
}

body.dark-mode .user-email.no-email {
    color: #666;
}

/* Email modal responsive */
@media (max-width: 768px) {
    .modal-email {
        max-width: 95%;
        padding: 15px;
    }

    .email-recording-meta {
        flex-direction: column;
        gap: 5px;
    }

    .email-manual-entry {
        flex-direction: column;
    }

    .btn-add-email {
        width: 100%;
    }
}
