/* =============================================
   PROFESSIONAL EMAIL DASHBOARD - LIGHT/WHITE THEME
   ============================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables - Light Theme */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #7c3aed;
    --accent: #0891b2;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gray);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* =============================================
   HEADER
   ============================================= */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

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

.logo-img {
    border-radius: var(--radius);
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* =============================================
   MAIN CONTAINER
   ============================================= */
.main-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* =============================================
   STATS CARDS
   ============================================= */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.pending {
    border-left: 4px solid var(--warning);
}

.stat-card.sent {
    border-left: 4px solid var(--success);
}

.stat-card.failed {
    border-left: 4px solid var(--danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-card.pending .stat-icon {
    background: var(--warning-light);
}

.stat-card.sent .stat-icon {
    background: var(--success-light);
}

.stat-card.failed .stat-icon {
    background: var(--danger-light);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-card p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =============================================
   SECTIONS
   ============================================= */
section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* File Upload */
.file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-light);
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.file-upload p {
    color: var(--text-secondary);
    font-size: 14px;
}

.file-upload p strong {
    color: var(--primary);
}

.file-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.file-name {
    margin-top: 10px;
    color: var(--success);
    font-weight: 500;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #b45309;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* =============================================
   FILTER BAR
   ============================================= */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.filter-bar label {
    margin-bottom: 0;
    font-weight: 500;
    white-space: nowrap;
}

.filter-bar select {
    width: auto;
    min-width: 150px;
}

/* =============================================
   TABLE
   ============================================= */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-light);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-light);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pending {
    background: var(--warning-light);
    color: var(--warning);
}

.status-sent {
    background: var(--success-light);
    color: var(--success);
}

.status-failed {
    background: var(--danger-light);
    color: var(--danger);
}

/* =============================================
   RECIPIENT DETAILS
   ============================================= */
.recipient-details {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.recipient-details.active {
    display: block;
}

.recipient-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.details-grid > div {
    padding: 10px 14px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.details-grid strong {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.details-grid span {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* =============================================
   EMAIL PREVIEW
   ============================================= */
.email-preview {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.email-preview.active {
    display: block;
}

.email-preview label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.email-preview textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.email-preview textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* =============================================
   MODAL
   ============================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.modal-body {
    padding: 25px;
}

.modal-body textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* =============================================
   LOADING OVERLAY
   ============================================= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =============================================
   MESSAGES
   ============================================= */
.message {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.message.active {
    display: block;
}

.message.success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.message.error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.message.info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .header {
        padding: 0 15px;
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar select {
        width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 18px;
    }
    
    .stat-card h3 {
        font-size: 28px;
    }
    
    .user-name {
        display: none;
    }
    
    th, td {
        padding: 12px 8px;
        font-size: 13px;
    }
}

/* =============================================
   LOGIN PAGE - LIGHT
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gray);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

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

.login-header img {
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form .form-control {
    padding: 14px 16px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
}

.login-error {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}

.login-error.active {
    display: block;
}

/* =============================================
   ATTACHMENT AREA
   ============================================= */
.attachment-area {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}

.attachment-area label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

.attachment-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.attachment-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

/* =============================================
   SENDER NAME INPUT
   ============================================= */
.sender-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* =============================================
   FOOTER
   ============================================= */
footer {
    text-align: center;
    padding: 25px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
    background: var(--bg-white);
}

/* =============================================
   ACTION BUTTONS
   ============================================= */
.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

