/* Red notification badge for pending approval (admin) */
.pending-badge {
    display: inline-block;
    margin-left: 8px;
    width: 12px;
    height: 12px;
    background: #e53935;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: 0 0 0 2px #fff;
}

/* Reset and base styles */
/* Generic button style (exclude nav, Quill, logout, back buttons) */
button:not(.nav-tab):not(.ql-bold):not(.ql-italic):not(.ql-underline):not(.ql-strike):not(.ql-list):not(.ql-header):not(.ql-blockquote):not(.ql-code-block):not(.ql-link):not(.ql-image):not(.ql-video):not(.ql-clean):not(.ql-picker):not(.ql-picker-label):not(.ql-picker-options):not(.ql-picker-item):not(.ql-color):not(.ql-background):not(.ql-align):not(.ql-direction):not(.ql-indent):not(.ql-script):not(.ql-toolbar):not(.ql-formats):not(.ql-tooltip):not(.ql-container):not(.ql-editor):not(.logout-btn):not(.back-btn) {
    border: none !important;
    padding: 12px 28px !important;
    border-radius: 8px;
    background: #e3e8f7;
    color: #222;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
}
button:not(.nav-tab):not(.ql-bold):not(.ql-italic):not(.ql-underline):not(.ql-strike):not(.ql-list):not(.ql-header):not(.ql-blockquote):not(.ql-code-block):not(.ql-link):not(.ql-image):not(.ql-video):not(.ql-clean):not(.ql-picker):not(.ql-picker-label):not(.ql-picker-options):not(.ql-picker-item):not(.ql-color):not(.ql-background):not(.ql-align):not(.ql-direction):not(.ql-indent):not(.ql-script):not(.ql-toolbar):not(.ql-formats):not(.ql-tooltip):not(.ql-container):not(.ql-editor):not(.logout-btn):not(.back-btn):hover {
    background: #d1d9ee;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif !important;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login page styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #667eea;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 1.1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
    display: none;
}

/* Dashboard styles */
.dashboard {
    display: none;
    min-height: 100vh;
    background: #f8fafc;
}

.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h2 {
    color: #667eea;
    font-weight: 600;
}

.navbar .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e1e5e9;
}

.nav-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.nav-tab:hover {
    color: #667eea;
}

/* Send Email styles */
.send-email-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.section-title-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.recipient-selection {
    margin-bottom: 2rem;
}

.recipient-list {
    display: grid;
    grid-template-columns: repeat(9, 1fr); /* 9 columns */
    gap: 8px;
    margin-top: 1rem;
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.recipient-card {
    background: #f8fafc;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
    min-height: 36px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 0.85rem;
}

.recipient-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.recipient-card.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.recipient-name {
    font-weight: 600;
    margin-bottom: 1px;
}

.recipient-email {
    display: none; /* Hide email */
}

.recipient-specialty {
    color: #667eea;
    font-size: 0.75em;
    margin-top: 1px;
}

/* Compact recipient card styles */
.recipient-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    width: 100%;
    margin: 0 auto;
}

.recipient-card.compact {
    padding: 10px 8px;
    font-size: 0.95rem;
    border-radius: 8px;
    background: #f7f8fa;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: background 0.2s, border 0.2s;
}

.recipient-card.compact.selected {
    background: #e0e7ff;
    border-color: #667eea;
}

.recipient-card.compact .recipient-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.recipient-card.compact .recipient-specialty {
    font-size: 0.85em;
    color: #666;
}

/* Select All button styles */
.select-all-container {
    margin-bottom: 15px;
}

.select-all-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.select-all-btn:hover {
    transform: translateY(-1px);
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-weight: 500;
    color: #333;
}

.form-row input,
.form-row textarea {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.form-row textarea {
    min-height: 200px;
    resize: vertical;
}

/* Make save-draft-btn look exactly like send-btn */
.send-btn, .save-draft-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    align-self: flex-start;
}

.send-btn:hover, .save-draft-btn:hover {
    transform: translateY(-2px);
}

/* Attachment Section */
.attachment-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attach-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease;
    align-self: flex-start;
}

.attach-btn:hover {
    transform: translateY(-1px);
}

.attachment-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.attachment-item {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 120px;
}

.attachment-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.attachment-name {
    font-size: 0.8rem;
    color: #495057;
    text-align: center;
    word-break: break-word;
    max-width: 100px;
}

.remove-attachment {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.remove-attachment:hover {
    background: #c82333;
}

/* Email Attachments Display */
.email-attachments {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.email-attachments h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1rem;
}

.attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.attachment-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 150px;
}

.attachment-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.attachment-display .attachment-name {
    font-size: 0.85rem;
    color: #495057;
    text-align: center;
    word-break: break-word;
    max-width: 120px;
}

/* View Emails styles */
.view-emails-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.view-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
}

.mode-btn {
    padding: 10px 20px;
    background: #f8fafc;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.emails-list,
.recipients-list {
    display: grid;
    gap: 15px;
}

.email-item,
.recipient-item {
    background: #f8fafc;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.email-item:hover,
.recipient-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.email-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.email-date {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.email-recipients {
    color: #667eea;
    font-size: 0.9rem;
}

.recipient-name-large {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.recipient-email-large {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.recipient-stats {
    color: #667eea;
    font-size: 0.9rem;
}

/* Individual email/recipient page styles */
.individual-page {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.email-details {
    margin-bottom: 2rem;
}

.email-content {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    margin: 1rem 0;
    white-space: pre-wrap;
}

.email-content-view {
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    padding: 16px;
    margin-top: 10px;
    min-height: 100px;
}

.recipients-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.recipients-table th,
.recipients-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.recipients-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #333;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 600;
    color: #fff;
    margin-right: 4px;
}

.status-unseen { background: #e74c3c; }
.status-seen { background: #f1c40f; color: #333; }
.status-responded { background: #2ecc71; }

/* Response content styles */
.response-content {
    max-width: 300px;
}

.response-date {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.response-text {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.no-response {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

/* Recipient controls and pagination styles */
.recipient-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 16px 0 0 0;
    flex-wrap: nowrap;
}

/* Responsive design */
@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 15px;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .recipient-list {
        grid-template-columns: 1fr;
    }
    
    .view-mode-toggle {
        flex-direction: column;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#quill-editor {
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    margin-bottom: 8px;
}