/* Dashboard Layout */
.main-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 70px; /* Collapsed width */
    background: var(--surface-color); /* Updated to use variable */
    border-right: 1px solid var(--border-color); /* Updated */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 40px;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.5));
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.nav-item {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    color: #a3a3a3;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 1.1rem;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: #fff;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* Tooltip on hover */
.nav-item::after {
    content: attr(title);
    position: absolute;
    left: 60px;
    background: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.nav-item:hover::after {
    opacity: 1;
}

.divider {
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.nav-item.logout:hover {
    color: #f87171;
    background: rgba(220, 38, 38, 0.1);
}

/* User Profile Header */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
    margin-right: auto; /* Push actions to right */
}

.user-profile-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.welcome-text {
    font-size: 0.7rem;
    color: #a3a3a3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.user-avatar-small {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Avatar Upload */
.avatar-upload {
    position: relative;
    max-width: 100px;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    background: #2d2d2d;
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 2.5rem;
    color: #fff;
    font-weight: bold;
}

.avatar-edit {
    position: absolute;
    right: 0;
    bottom: 0;
}

.avatar-edit input {
    display: none;
}

.avatar-edit label {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-bottom: 0;
    border-radius: 100%;
    background: #fff;
    border: 1px solid transparent;
    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-weight: normal;
    transition: all 0.2s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.avatar-edit label:hover {
    background: #f1f1f1;
    border-color: #d6d6d6;
}

/* Content Area */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    padding: var(--spacing-lg) var(--spacing-xl);
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.top-bar h3 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 15px;
}

.btn-primary-sm, .btn-secondary-sm {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary-sm {
    background: var(--accent-color);
    color: #fff;
}

.btn-secondary-sm {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

.btn-secondary-sm:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Email List Styling */
.email-card-list {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.email-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: rgba(18, 18, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.email-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
}

.email-content-preview {
    flex: 1;
    min-width: 0; /* Text truncation fix */
}

.email-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.sender {
    color: #fff;
    font-weight: 600;
}

.subject {
    color: #e0e0e0;
    font-weight: 500;
    margin-bottom: 5px;
}

.preview-text {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #666;
}
