/* ===== MOBILE RESPONSIVE - Tinyhost Email Reader ===== */
/* Bổ sung cho mobile, KHÔNG ảnh hưởng desktop */

@media screen and (max-width: 768px) {

    /* === Title === */
    .main-title h1 {
        font-size: 1.5em;
        letter-spacing: 1px;
    }

    .nav-btn {
        font-size: 0.8rem;
        padding: 8px 14px;
    }

    /* === Container === */
    .container {
        padding: 10px;
        margin: 0 5px 10px;
        border-radius: 8px;
    }

    /* === Card === */
    .email-setup .card {
        padding: 10px;
    }

    .card h2 {
        font-size: 1.1em;
    }

    /* === Form Controls === */
    .email-group .form-control-inline,
    .form-control-inline {
        min-width: 0 !important;
        width: 100% !important;
    }

    .email-group label,
    .domain-group label {
        font-size: 0.82rem;
        min-width: 55px;
    }

    /* === TABLE: card view cho mobile === */
    .email-table {
        display: block !important;
        border: none !important;
    }

    .email-table thead {
        display: none !important;
    }

    .email-table tbody {
        display: block !important;
    }

    .email-table tbody tr {
        display: block !important;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 10px 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .email-table tbody tr:hover {
        background: #f8f9fa;
    }

    .email-table td {
        display: block !important;
        text-align: left !important;
        padding: 3px 0 !important;
        border: none !important;
        width: 100% !important;
        font-size: 0.82rem;
    }

    .email-table td::before {
        font-weight: 700;
        color: #7f8c8d;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 6px;
    }

    /* Sender = card title */
    .email-table td:first-child {
        font-weight: 600;
        color: #2980b9;
        padding-bottom: 4px !important;
        border-bottom: 1px solid #e0e6ed !important;
        margin-bottom: 4px;
    }

    .email-table td:first-child::before {
        content: "From: ";
    }

    /* Subject */
    .email-table td:nth-child(2)::before {
        content: "Subject: ";
    }

    .email-table td:nth-child(2) {
        font-weight: 500;
        color: #2c3e50;
    }

    /* Date */
    .email-table td:nth-child(3)::before {
        content: "Date: ";
    }

    .email-table td:nth-child(3) {
        color: #7f8c8d;
        font-size: 0.75rem;
    }

    /* Actions */
    .email-table td.actions-cell {
        padding-top: 8px !important;
        border-top: 1px solid #e0e6ed !important;
        margin-top: 4px;
    }

    .actions-cell .btn-action {
        padding: 6px 12px;
        font-size: 0.78rem;
        margin-right: 4px;
        margin-bottom: 4px;
    }

    /* === Pagination mobile === */
    .pagination-wrapper {
        padding: 10px !important;
    }

    .pagination-left label,
    .pagination-left select {
        font-size: 0.8rem;
    }

    .pagination-center {
        font-size: 0.78rem;
    }

    /* === Section Header === */
    .section-header {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 1.1em;
    }

    /* === Bulk Email Reader === */
    .bulk-mail-section .section-header h2 {
        font-size: 1em;
    }

    .bulk-mail-card {
        padding: 10px;
    }

    .bulk-textarea {
        font-size: 0.75rem;
        min-height: 80px;
        padding: 8px;
    }

    .bulk-actions {
        flex-direction: column;
        gap: 6px;
    }

    .bulk-actions .btn {
        width: 100%;
        font-size: 0.85rem;
    }

    .bulk-email-group {
        margin-bottom: 10px;
    }

    .bulk-email-group-header {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }

    .bulk-email-group-header span {
        font-size: 0.75rem;
        word-break: break-all;
    }

    /* === Modal === */
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-header {
        padding: 12px 15px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 12px;
        max-height: 50vh;
    }

    .detail-row {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .detail-row strong {
        font-size: 0.82rem;
    }

    .modal-footer {
        padding: 10px 15px;
    }

    /* === Theme Switch === */
    .theme-switch-wrapper {
        transform: scale(0.85);
        margin: 10px auto;
    }

    /* === Toast === */
    .toast {
        font-size: 0.8rem;
        padding: 10px 16px;
        max-width: calc(100% - 30px);
    }

    /* === Footer === */
    .footer {
        padding: 12px;
        font-size: 0.78rem;
    }
}

/* === DARK THEME mobile overrides === */
@media screen and (max-width: 768px) {
    [data-theme="dark"] .email-table tbody tr {
        background: #0d1f3c;
        border-color: #2a5a8f;
    }

    [data-theme="dark"] .email-table td:first-child {
        color: #00d4ff;
        border-bottom-color: #2a5a8f !important;
    }

    [data-theme="dark"] .email-table td:nth-child(2) {
        color: #e0e6ed;
    }

    [data-theme="dark"] .email-table td:nth-child(3) {
        color: #8899aa;
    }

    [data-theme="dark"] .email-table td::before {
        color: #6b8299;
    }

    [data-theme="dark"] .email-table td.actions-cell {
        border-top-color: #2a5a8f !important;
    }
}

/* Very small phones */
@media screen and (max-width: 400px) {
    .main-title h1 {
        font-size: 1.2em;
    }

    .container {
        padding: 8px;
    }

    .card h2 {
        font-size: 0.95em;
    }

    .nav-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
    }

    .email-table td {
        font-size: 0.75rem;
    }
}