/**
 * IDK Mail - Modern UI Enhancements
 * Empty State + Responsive Improvements
 * @version 3.0
 */

/* =============================================================================
   MODERN EMPTY STATE
   ============================================================================= */
.empty-state-modern {
    text-align: center;
    padding: 60px 30px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.03) 0%, transparent 100%);
    border-radius: 20px;
}

/* Mailbox Illustration */
.empty-illustration {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.mailbox {
    position: relative;
    width: 80px;
    height: 60px;
    margin: 30px auto 0;
}

.mailbox-body {
    width: 80px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px 8px 4px 4px;
    position: relative;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    animation: mailboxBounce 2s ease-in-out infinite;
}

.mailbox-body::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 20px;
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    border-radius: 20px 20px 0 0;
}

.mailbox-body::after {
    content: '📭';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
}

.mailbox-flag {
    position: absolute;
    right: -15px;
    top: 5px;
    width: 8px;
    height: 25px;
    background: #ef4444;
    border-radius: 2px;
    transform-origin: bottom;
    animation: flagWave 1.5s ease-in-out infinite;
}

.mailbox-flag::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 15px;
    height: 10px;
    background: #ef4444;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.mailbox-post {
    width: 10px;
    height: 30px;
    background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
    margin: 0 auto;
    border-radius: 0 0 3px 3px;
}

/* Floating particles */
.empty-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.empty-particles span {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat 3s ease-in-out infinite;
}

.empty-particles span:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.empty-particles span:nth-child(2) {
    top: 20%;
    right: 25%;
    animation-delay: 1s;
    width: 6px;
    height: 6px;
}

.empty-particles span:nth-child(3) {
    bottom: 30%;
    left: 30%;
    animation-delay: 2s;
    width: 10px;
    height: 10px;
}

@keyframes mailboxBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes flagWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-5deg); }
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-15px) scale(1.2);
        opacity: 0.3;
    }
}

/* Empty state text */
.empty-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0 0 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-desc {
    font-size: 1em;
    color: var(--text-muted, #64748b);
    margin: 0 0 25px;
}

/* Shortcut chips */
.empty-shortcuts {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.shortcut-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-light, #f1f5f9);
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--text-secondary, #475569);
    transition: all 0.2s ease;
}

.shortcut-chip:hover {
    background: var(--bg-white, #fff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.shortcut-chip kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 600;
}

/* CTA Button */
.empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.empty-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.empty-cta:active {
    transform: translateY(-1px);
}

/* =============================================================================
   RESPONSIVE IMPROVEMENTS
   ============================================================================= */

/* Mobile First - Base styles for small screens */
@media (max-width: 768px) {
    /* Header */
    .main-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        border-radius: 0;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .nav-links a {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .nav-links a img {
        display: none;
    }

    /* Container */
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 16px;
    }

    /* Form group */
    .form-group {
        padding: 15px;
        border-radius: 12px;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-group input,
    .input-group select {
        width: 100%;
        min-width: unset;
    }

    #domainSelect {
        width: 100%;
    }

    /* Action buttons */
    .action-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .action-btn {
        padding: 10px 8px;
        font-size: 0.8em;
        border-radius: 10px;
    }

    /* Hide text on some buttons, show only icon */
    .action-btn.more-btn,
    .action-btn.qr-btn {
        padding: 10px;
    }

    /* Email list header */
    .email-list-header {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .email-list-header h2 {
        font-size: 1.1em;
        text-align: center;
    }

    .add-domain {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .add-domain input {
        width: auto;
        min-width: 120px;
        flex: 1;
        max-width: 180px;
    }

    /* Table - Card style on mobile */
    #emailTable {
        display: block;
    }

    #emailTable thead {
        display: none;
    }

    #emailTable tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #emailTable tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-white, #fff);
        border-radius: 12px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        border-left: 4px solid transparent;
    }

    #emailTable tbody tr.unread {
        border-left-color: #667eea;
        background: linear-gradient(90deg, rgba(102, 126, 234, 0.05), transparent);
    }

    #emailTable tbody tr td {
        display: block;
        padding: 4px 0;
        border: none;
    }

    #emailTable tbody tr td:first-child {
        position: absolute;
        top: 15px;
        right: 15px;
    }

    #emailTable tbody tr td:nth-child(2) {
        font-weight: 600;
        font-size: 0.95em;
        color: var(--text-primary);
        order: 1;
    }

    #emailTable tbody tr td:nth-child(3) {
        font-size: 0.9em;
        color: var(--text-secondary);
        order: 2;
        margin-top: 5px;
    }

    #emailTable tbody tr td:nth-child(4) {
        font-size: 0.8em;
        color: var(--text-muted);
        order: 3;
        margin-top: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* OTP button on mobile */
    .otp-copy-btn {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    /* Preview snippet on mobile */
    .email-preview-snippet {
        display: block;
        margin-top: 8px;
        font-size: 0.85em;
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Empty state on mobile */
    .empty-state-modern {
        padding: 40px 20px;
    }

    .empty-illustration {
        transform: scale(0.85);
    }

    .empty-title {
        font-size: 1.3em;
    }

    .empty-shortcuts {
        gap: 8px;
    }

    .shortcut-chip {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    /* Footer */
    .site-footer {
        padding: 20px 15px;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    .footer-copyright {
        font-size: 0.8em;
        flex-direction: column;
        gap: 5px;
    }

    .footer-shortcuts {
        display: none;
    }

    /* Search box */
    .search-box input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Pagination */
    .pagination-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    /* Banner */
    .maintenance-banner {
        font-size: 0.8em;
        padding: 8px;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .empty-shortcuts {
        flex-direction: column;
        align-items: center;
    }

    .shortcut-chip {
        width: 100%;
        max-width: 150px;
        justify-content: center;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 20px auto;
    }

    .action-buttons {
        justify-content: center;
    }

    #emailTable th:nth-child(2),
    #emailTable td:nth-child(2) {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        padding: 12px 15px !important;
    }

    #emailTable th:nth-child(4),
    #emailTable td:nth-child(4) {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        text-align: center !important;
        padding: 12px 15px !important;
    }
}

/* Large desktop */
@media (min-width: 1400px) {
    .container {
        max-width: 1200px;
    }

    #emailTable th:nth-child(2),
    #emailTable td:nth-child(2) {
        width: 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
        padding: 12px 15px !important;
    }

    #emailTable th:nth-child(4),
    #emailTable td:nth-child(4) {
        width: 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
        text-align: center !important;
        padding: 12px 15px !important;
    }
}

/* =============================================================================
   DARK MODE ADJUSTMENTS
   ============================================================================= */
[data-theme="dark"] .empty-state-modern {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08) 0%, transparent 100%);
}

[data-theme="dark"] .shortcut-chip {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .shortcut-chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #emailTable tbody tr {
    background: var(--bg-white, #1e293b);
}

[data-theme="dark"] #emailTable tbody tr.unread {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15), var(--bg-white, #1e293b));
}

/* =============================================================================
   TOUCH IMPROVEMENTS
   ============================================================================= */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .action-btn {
        min-height: 44px;
    }

    #emailTable tbody tr {
        min-height: 60px;
    }

    .email-checkbox {
        width: 22px;
        height: 22px;
    }

    /* Remove hover effects on touch */
    .action-btn:hover {
        transform: none;
    }

    #emailTable tbody tr:hover {
        transform: none;
    }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */
@media print {
    .main-header,
    .action-buttons,
    .maintenance-banner,
    .site-footer,
    .empty-cta,
    .empty-shortcuts {
        display: none !important;
    }

    .container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }

    #emailTable {
        box-shadow: none;
    }
}
