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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

h2 {
    color: #555;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

/* Logo */
.logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
}

/* Login Screen */
#login-screen {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    margin-top: 100px;
}

#login-form {
    margin-top: 30px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.header-logo {
    height: 50px;
    width: auto;
}

/* Card */
.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Forms */
input[type="password"],
input[type="email"],
input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    margin-bottom: 10px;
}

form {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

form input {
    flex: 1;
    margin-bottom: 0;
}

#add-form input[type="text"] {
    flex: 0.6;
}

#add-form input[type="email"] {
    flex: 1;
}

/* Buttons */
button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background: #0056b3;
}

#logout-btn {
    background: #6c757d;
}

#logout-btn:hover {
    background: #545b62;
}

/* Recipients List */
.recipient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

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

.recipient-item button {
    background: #dc3545;
    padding: 5px 15px;
    font-size: 14px;
}

.recipient-item button:hover {
    background: #c82333;
}

.copy-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    padding: 4px;
    margin-right: 8px;
    border-radius: 3px;
    transition: all 0.2s;
}

.copy-icon:hover {
    color: #495057;
    background: #f8f9fa;
}

.copy-icon.copied {
    color: #28a745;
}

.copy-icon svg {
    display: block;
}

/* Activity List */
.activity-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

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

.activity-item .date {
    color: #666;
    font-size: 12px;
}

.activity-item .subject {
    font-weight: 500;
    margin: 5px 0;
}

.activity-item .from {
    color: #666;
}

/* Messages */
.error {
    color: #dc3545;
    margin-top: 10px;
    font-size: 14px;
}

.success {
    color: #28a745;
    margin-top: 10px;
    font-size: 14px;
}

.empty {
    color: #999;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Add Recipient Section */
.add-recipient-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.add-recipient-section form {
    margin-bottom: 10px;
}

/* Bulk Upload */
.bulk-upload-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 0;
    border: 1px solid #e9ecef;
}

.hint {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.file-upload-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#csv-filename {
    color: #666;
    font-size: 14px;
    flex: 1;
}

#csv-process-btn {
    background: #28a745;
}

#csv-process-btn:hover {
    background: #218838;
}

#csv-results {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 14px;
    border: 1px solid #dee2e6;
}

#csv-results .result-section {
    margin-bottom: 10px;
}

#csv-results .result-section:last-child {
    margin-bottom: 0;
}

#csv-results .result-title {
    font-weight: 600;
    margin-bottom: 5px;
}

#csv-results .result-list {
    margin-left: 15px;
    color: #666;
}

/* Recipients Header */
.recipients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Search Container */
.search-container {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-container input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#search-results-count {
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

/* Section Header (for activity, errors, unsubscribes) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-clear {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-clear:hover {
    background: #c82333;
}

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

.bulk-actions button {
    padding: 8px 16px;
    font-size: 14px;
}

button.danger {
    background: #dc3545;
}

button.danger:hover {
    background: #c82333;
}

/* Recipient item with checkbox */
.recipient-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.recipient-item .email {
    flex: 1;
}

.recipient-item .actions {
    display: flex;
    gap: 5px;
}

/* Footer form */
#footer-form {
    display: block;
}

#footer-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

#footer-form button {
    background: #28a745;
}

#footer-form button:hover {
    background: #218838;
}

/* ========== Security Settings & MFA Styles ========== */

.mfa-status-display {
    margin-top: 10px;
}

.mfa-status-display h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.mfa-status-display p {
    margin: 10px 0;
}

#security-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

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

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content.small {
    max-width: 400px;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

/* TOTP Setup Steps */
.totp-step {
    text-align: center;
}

.totp-step p {
    margin-bottom: 20px;
    color: #666;
}

.qr-code-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.manual-entry {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.manual-entry p {
    margin-bottom: 10px;
    font-size: 14px;
}

.secret-code {
    display: block;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    max-width: 150px;
}

button.secondary {
    background: #6c757d;
}

button.secondary:hover {
    background: #5a6268;
}

button.primary {
    background: #007bff;
}

button.primary:hover {
    background: #0056b3;
}

#totp-verify-input {
    width: 100%;
    max-width: 200px;
    margin: 0 auto 20px auto;
    text-align: center;
    font-size: 24px;
    letter-spacing: 5px;
    font-family: 'Courier New', monospace;
}

/* Recovery Codes */
.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.success-message h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.success-message p {
    margin: 0;
}

.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.recovery-code {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: center;
}

.warning-text {
    color: #dc3545;
    font-weight: bold;
    text-align: center;
    margin: 15px 0;
}

/* Disable TOTP Modal */
#disable-totp-modal .modal-content {
    text-align: center;
}

#disable-totp-modal h2 {
    color: #dc3545;
}

#disable-totp-modal p {
    margin: 20px 0;
    color: #666;
}

/* Pagination Controls */
#pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-buttons button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-buttons button:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #007bff;
}

.pagination-buttons button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: #666;
}
