/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --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);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    
    --border-color: #374151;
    --border-hover: #4b5563;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-image {
    height: 2.5rem;
    width: auto;
    transition: transform 0.2s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Email Section */
.email-section {
    margin-bottom: 2rem;
}

.email-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.email-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.email-display {
    margin-bottom: 1.5rem;
}

.email-address {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    gap: 0.75rem;
    transition: border-color 0.2s ease;
}

.email-address:hover {
    border-color: var(--primary-color);
}

#emailText {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 1.125rem;
    min-width: 3rem;
}

.copy-btn:hover {
    background: var(--primary-hover);
}

/* Email Controls */
.email-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timer-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timer i {
    color: var(--warning-color);
}

.timer-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timer-select:hover {
    border-color: var(--border-hover);
}

.timer-select:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Content Layout */
.content-layout {
    display: grid;
    /*grid-template-columns: 1fr; */
    grid-template-columns: 68% 32%;
    gap: 2rem;
}

/* Inbox Section */
.inbox-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.inbox-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.email-count {
    color: var(--text-muted);
    font-weight: 400;
}

.inbox-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.status-indicator {
    font-size: 0.5rem;
    color: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.inbox-container {
    min-height: 200px;
    max-height: 300px;
}

.empty-inbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-inbox i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-inbox p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.empty-inbox small {
    font-size: 0.875rem;
}

/* Email List */
.email-list {
    display: none;
}

.email-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.email-item:last-child {
    margin-bottom: 0;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.email-sender {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

.email-subject {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-preview {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    margin-right: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.email-meta {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.email-meta > div {
    margin-bottom: 0.5rem;
}

.email-meta > div:last-child {
    margin-bottom: 0;
}

.email-content {
    color: var(--text-primary);
    line-height: 1.6;
    word-wrap: break-word;
}

/* Email content button styles */
.email-content .email-button:hover {
    background: #0256cc !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(3, 102, 214, 0.3);
}

.email-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.email-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.email-content p {
    margin-bottom: 1rem;
}

.email-content ul, .email-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.email-content li {
    margin-bottom: 0.5rem;
}

/* Attachments Styles */
.attachments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.attachments-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attachments-section h4 i {
    color: var(--primary-color);
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attachment-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.attachment-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    min-width: 2rem;
    text-align: center;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.attachment-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.attachment-download {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.attachment-download:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.attachment-download i {
    font-size: 0.875rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Ad Spaces */
.ad-space {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.ad-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.ad-header .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-footer .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.sidebar-ad {
    display: none;
}

.ad-sidebar .ad-placeholder {
    width: 300px;
    height: 250px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* === Compact inbox like sidebar ad (≈300x250) === */
.inbox-section {
  padding: 1rem;                 /* tighter padding */
  max-height: 300px;             /* cap the card height */
}

.inbox-container {
  height: 250px;                 /* visible area, similar to 300x250 */
  min-height: 0;                 /* remove earlier min-height */
  overflow: auto;                /* scroll when emails overflow */
  display: flex;
  align-items: center;           /* center empty state vertically */
  justify-content: center;
}

.empty-inbox {
  padding: 0.75rem;              /* reduce large empty-state padding */
}

.email-list {
  width: 100%;
}

/* Optional: only compact on desktop */
@media (max-width: 767px) {
  .inbox-section { max-height: none; }
  .inbox-container { height: auto; overflow: visible; }
}


/* Responsive Design */
@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
    
    .email-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .content-layout {
     /*    grid-template-columns: 1fr 320px; */
       grid-template-columns: 68% 32%;
    }
    
    .sidebar-ad {
        display: block;
    }
    
    .toast {
        bottom: 2rem;
        right: 2rem;
    }
}

@media (min-width: 1024px) {
    .email-container {
        padding: 2.5rem;
    }
    
    .inbox-section {
        padding: 2rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}