/* ========================================
   MAIL PAGE - CSS (Split Pane Layout)
   ======================================== */

/* Page Header */
.page-header {
    padding: 100px 0 30px;
    text-align: center;
}

.page-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Mail Content */
.mail-content {
    padding: 0 0 80px;
}

/* Mail Layout - Split Pane */
.mail-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    background: linear-gradient(180deg, rgba(25, 15, 50, 0.8) 0%, rgba(15, 10, 31, 0.9) 100%);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 16px;
    overflow: hidden;
    min-height: 600px;
}

/* Left: Mail List Panel */
.mail-list-panel {
    border-right: 1px solid rgba(168, 85, 247, 0.15);
    display: flex;
    flex-direction: column;
}

/* Mail Actions Bar */
.mail-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

.mail-select-all {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-label .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(168, 85, 247, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--purple-500);
    border-color: var(--purple-500);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid var(--dark-purple-900);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.mail-btns {
    display: flex;
    gap: 10px;
}

.btn-mail-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: var(--purple-500);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-mail-action svg {
    width: 16px;
    height: 16px;
}

.btn-mail-action:hover {
    background: rgba(168, 85, 247, 0.2);
}

.btn-mail-action.delete {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.1);
}

.btn-mail-action.delete:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Mail List */
.mail-list-scroll {
    flex: 1;
    overflow-y: auto;
}

.mail-list {
    display: block;
}

/* Hide tabs - not used */
.mail-tabs {
    display: none;
}

/* Mail Item */
.mail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.mail-item:last-child {
    border-bottom: none;
}

.mail-item:hover {
    background: rgba(168, 85, 247, 0.08);
}

.mail-item.active {
    background: rgba(168, 85, 247, 0.12);
    border-left: 3px solid var(--purple-500);
}

.mail-item.unread {
    background: rgba(168, 85, 247, 0.05);
}

.mail-item.unread .mail-subject {
    font-weight: 600;
    color: var(--text-primary);
}

/* Mail Status */
.mail-status {
    width: 30px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.unread-dot {
    width: 10px;
    height: 10px;
    background: var(--purple-500);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--purple-500);
}

/* Mail Info */
.mail-info {
    flex: 1;
    min-width: 0;
}

.mail-sender {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.mail-subject {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mail-subject .badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.admin {
    background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    color: var(--dark-purple-900);
}

.badge.support {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: #fff;
}

.badge.bonus {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: var(--dark-purple-900);
}

.badge.system {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: #fff;
}

.mail-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.mail-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Mail List Pagination */
.mail-list-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border-top: 1px solid rgba(168, 85, 247, 0.15);
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(25, 15, 50, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn svg {
    width: 16px;
    height: 16px;
}

.page-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    color: var(--text-primary);
}

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

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(25, 15, 50, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-num:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
}

.page-num.active {
    background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    border-color: transparent;
    color: var(--dark-purple-900);
    font-weight: 600;
}

/* Right: Mail Detail Panel */
.mail-detail-panel {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
}

/* Empty State */
.mail-detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.5;
}

.mail-detail-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.mail-detail-empty p {
    font-size: 1rem;
}

/* Detail Content (shown when mail selected) */
.mail-detail-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.mail-detail-content.active {
    display: flex;
}

/* Mail Detail Header */
.mail-detail-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

.mail-detail-badge {
    margin-bottom: 10px;
}

.mail-detail-subject {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.mail-detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.mail-detail-sender,
.mail-detail-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.mail-detail-sender::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--purple-500);
    border-radius: 50%;
    margin-right: 8px;
}

/* Mail Detail Body */
.mail-detail-body {
    padding: 25px 30px;
    flex: 1;
    overflow-y: auto;
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.mail-detail-body p {
    margin-bottom: 15px;
}

/* Mail Detail Actions */
.mail-detail-actions {
    padding: 20px 30px;
    border-top: 1px solid rgba(168, 85, 247, 0.15);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn-delete-mail {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #ff6b6b;
}

.btn-delete-mail svg {
    width: 18px;
    height: 18px;
}

.btn-delete-mail:hover {
    background: rgba(255, 107, 107, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }

    .mail-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .mail-list-panel {
        border-right: none;
    }

    /* Mobile: toggle between list and detail */
    .mail-layout.showing-detail .mail-list-panel {
        display: none;
    }

    .mail-layout:not(.showing-detail) .mail-detail-panel {
        display: none;
    }

    .mail-detail-panel {
        min-height: 400px;
    }

    /* Back button for mobile */
    .btn-back-to-list {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: rgba(168, 85, 247, 0.1);
        border: none;
        border-bottom: 1px solid rgba(168, 85, 247, 0.15);
        color: var(--purple-500);
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        width: 100%;
    }

    .btn-back-to-list svg {
        width: 18px;
        height: 18px;
    }

    .mail-actions {
        flex-direction: column;
        gap: 10px;
    }

    .mail-btns {
        width: 100%;
        justify-content: center;
    }

    .mail-item {
        padding: 12px 15px;
    }

    .mail-preview {
        display: none;
    }
}

@media (min-width: 769px) {
    .btn-back-to-list {
        display: none;
    }
}

@media (max-width: 500px) {
    .checkbox-label span:not(.checkmark) {
        display: none;
    }

    .page-numbers {
        gap: 3px;
    }

    .page-num,
    .page-btn {
        width: 28px;
        height: 28px;
    }
}
