/* Mail Layout */
.mail-layout {
    display: grid;
    grid-template-columns: 250px 350px 1fr;
    gap: 1rem;
    padding: 1rem;
    height: 100%;
    width: 100%;
    background: #ffffff;
    color: #202124;
}

[data-theme="dark"] .mail-layout {
    background: #1a1a1a;
    color: #e8eaed;
}

.mail-sidebar,
.mail-list,
.mail-content {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

[data-theme="dark"] .mail-sidebar,
[data-theme="dark"] .mail-list,
[data-theme="dark"] .mail-content {
    background: #202124;
    border-color: #3c4043;
}

.mail-sidebar {
    overflow-y: auto;
}

.mail-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mail-content {
    overflow-y: auto;
}

/* Folder Navigation */
.nav-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    border-radius: 0.5rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s;
    color: #5f6368;
}

[data-theme="dark"] .nav-item {
    color: #9aa0a6;
}

.nav-item:hover {
    background: rgba(26, 115, 232, 0.08);
    color: #1a73e8;
}

[data-theme="dark"] .nav-item:hover {
    background: rgba(138, 180, 248, 0.08);
    color: #8ab4f8;
}

.nav-item.active {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 500;
}

[data-theme="dark"] .nav-item.active {
    background: #1e3a5f;
    color: #8ab4f8;
}

.nav-item .count {
    margin-left: auto;
    background: #1a73e8;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

[data-theme="dark"] .nav-item .count {
    background: #8ab4f8;
    color: #202124;
}

/* Mail Items */
.mail-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s;
    position: relative;
}

[data-theme="dark"] .mail-item {
    border-bottom-color: #3c4043;
}

.mail-item:hover {
    background: rgba(26, 115, 232, 0.08);
}

[data-theme="dark"] .mail-item:hover {
    background: rgba(138, 180, 248, 0.08);
}

.mail-item.unread {
    background: #f8f9fa;
    font-weight: 500;
}

[data-theme="dark"] .mail-item.unread {
    background: #292a2d;
}

.mail-item.selected {
    background: #e8f0fe;
    border-left: 3px solid #1a73e8;
}

[data-theme="dark"] .mail-item.selected {
    background: #1e3a5f;
    border-left-color: #8ab4f8;
}

.mail-item-from {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: #202124;
}

[data-theme="dark"] .mail-item-from {
    color: #e8eaed;
}

.mail-item.unread .mail-item-from {
    font-weight: 600;
}

.mail-item-subject {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: #202124;
}

[data-theme="dark"] .mail-item-subject {
    color: #e8eaed;
}

.mail-item-preview {
    font-size: 0.75rem;
    color: #5f6368;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

[data-theme="dark"] .mail-item-preview {
    color: #9aa0a6;
}

.mail-item-time {
    font-size: 0.75rem;
    color: #5f6368;
}

[data-theme="dark"] .mail-item-time {
    color: #9aa0a6;
}

/* Mail Content View */
.mail-content-view {
    padding: 2rem;
}

.mail-content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #5f6368;
    text-align: center;
}

[data-theme="dark"] .mail-content-empty {
    color: #9aa0a6;
}

.mail-content-empty .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Mail Header */
.mail-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

[data-theme="dark"] .mail-header {
    border-bottom-color: #3c4043;
}

.mail-subject {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #202124;
}

[data-theme="dark"] .mail-subject {
    color: #e8eaed;
}

.mail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #5f6368;
}

[data-theme="dark"] .mail-meta {
    color: #9aa0a6;
}

.mail-from {
    font-weight: 500;
    color: #202124;
}

[data-theme="dark"] .mail-from {
    color: #e8eaed;
}

.mail-to {
    font-size: 0.75rem;
}

.mail-date {
    margin-left: auto;
}

/* Mail Body */
.mail-body {
    line-height: 1.7;
    color: #202124;
}

[data-theme="dark"] .mail-body {
    color: #e8eaed;
}

.mail-body p {
    margin-bottom: 1rem;
}

.mail-body p:last-child {
    margin-bottom: 0;
}

/* Headers */
h2,
h3 {
    margin: 0;
    padding: 0;
    font-weight: 500;
}

/* Scrollbar Styles */
.mail-sidebar::-webkit-scrollbar,
.mail-list::-webkit-scrollbar,
.mail-content::-webkit-scrollbar {
    width: 8px;
}

.mail-sidebar::-webkit-scrollbar-track,
.mail-list::-webkit-scrollbar-track,
.mail-content::-webkit-scrollbar-track {
    background: transparent;
}

.mail-sidebar::-webkit-scrollbar-thumb,
.mail-list::-webkit-scrollbar-thumb,
.mail-content::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 4px;
}

.mail-sidebar::-webkit-scrollbar-thumb:hover,
.mail-list::-webkit-scrollbar-thumb:hover,
.mail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

[data-theme="dark"] .mail-sidebar::-webkit-scrollbar-thumb,
[data-theme="dark"] .mail-list::-webkit-scrollbar-thumb,
[data-theme="dark"] .mail-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .mail-sidebar::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .mail-list::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .mail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Alpine.js cloak */
[x-cloak] {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .mail-layout {
        grid-template-columns: 200px 300px 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

@media (max-width: 768px) {
    .mail-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .mail-sidebar {
        max-height: 200px;
    }

    .mail-content {
        display: none;
    }

    .mail-item.selected + .mail-content {
        display: block;
    }
}
