/* ============================================
   DASHBOARD - STYLE PREMIUM
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --noir: #0a0a0a;
    --noir-soft: #1a1a1a;
    --noir-medium: #2a2a2a;
    --cream: #f5f1e8;
    --cream-dark: #ebe5d4;
    --or: #c9a961;
    --or-light: #d4b878;
    --or-dark: #a8893d;
    --gris: #8a8478;
    --gris-light: #c4bdaf;
    --green: #4caf50;
    --red: #f44336;
    --blue: #2196f3;
    --serif: 'Cormorant Garamond', serif;
    --display: 'Italiana', serif;
    --sans: 'Inter', sans-serif;
}

body {
    font-family: var(--sans);
    background: var(--cream);
    color: var(--noir);
    font-weight: 400;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 280px;
    background: var(--noir);
    color: var(--cream);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid rgba(201, 169, 97, 0.15);
}

.sidebar-header {
    padding: 30px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
}

.sidebar-logo {
    width: 50px; height: 50px;
    border: 2px solid var(--or);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--or);
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-family: var(--display);
    font-size: 20px;
    color: var(--cream);
    letter-spacing: 3px;
    line-height: 1;
}

.sidebar-brand-sub {
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--or);
    text-transform: uppercase;
    margin-top: 5px;
}

.sidebar-nav {
    flex: 1;
    padding: 25px 15px;
    overflow-y: auto;
}

.nav-section { margin-bottom: 30px; }

.nav-section-title {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gris);
    padding: 0 12px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    color: var(--gris-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-bottom: 4px;
    position: relative;
}

.nav-item i {
    width: 18px;
    font-size: 14px;
    color: var(--gris);
    transition: color 0.3s ease;
}

.nav-item:hover {
    background: rgba(201, 169, 97, 0.08);
    color: var(--cream);
}

.nav-item:hover i {
    color: var(--or);
}

.nav-item.active {
    background: var(--or);
    color: var(--noir);
    font-weight: 500;
}

.nav-item.active i {
    color: var(--noir);
}

.badge {
    margin-left: auto;
    background: var(--or);
    color: var(--noir);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.nav-item.active .badge {
    background: var(--noir);
    color: var(--or);
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(201, 169, 97, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 40px; height: 40px;
    background: var(--or);
    color: var(--noir);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-size: 18px;
    flex-shrink: 0;
}

.user-details { min-width: 0; flex: 1; }

.user-name {
    font-size: 13px;
    color: var(--cream);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: var(--or);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.logout-btn {
    width: 36px; height: 36px;
    background: transparent;
    border: 1px solid rgba(201, 169, 97, 0.3);
    color: var(--gris-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--red);
    border-color: var(--red);
    color: var(--cream);
}

/* ============================================
   MOBILE TOGGLE
   ============================================ */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 20px; left: 20px;
    width: 45px; height: 45px;
    background: var(--noir);
    color: var(--or);
    border: 1px solid var(--or);
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    padding: 40px;
}

.page-header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header-left {
    flex: 1;
    min-width: 280px;
}

.page-eyebrow {
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--or);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.page-title {
    font-family: var(--display);
    font-size: 48px;
    color: var(--noir);
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

.page-title .italic {
    font-style: italic;
    color: var(--or);
}

.page-subtitle {
    font-family: var(--serif);
    font-size: 18px;
    color: var(--gris);
    font-style: italic;
}

.btn {
    padding: 13px 28px;
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    font-family: var(--sans);
}

.btn-primary {
    background: var(--noir);
    color: var(--cream);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: var(--or);
    transition: left 0.4s ease;
}

.btn-primary span, .btn-primary i { position: relative; z-index: 1; transition: color 0.4s ease; }
.btn-primary:hover::before { left: 0; }
.btn-primary:hover { color: var(--noir); }

.btn-or {
    background: var(--or);
    color: var(--noir);
}

.btn-or:hover {
    background: var(--or-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--noir);
    border: 1px solid var(--noir);
}

.btn-secondary:hover {
    background: var(--noir);
    color: var(--cream);
}

/* ============================================
   STATS CARDS (Dashboard)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--cream-dark);
    padding: 30px;
    border-left: 3px solid var(--or);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(10, 10, 10, 0.1);
}

.stat-card-icon {
    width: 50px; height: 50px;
    background: rgba(201, 169, 97, 0.15);
    color: var(--or);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 20px;
}

.stat-card-label {
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--gris);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-card-value {
    font-family: var(--display);
    font-size: 42px;
    color: var(--noir);
    line-height: 1;
}

.stat-card-trend {
    font-family: var(--serif);
    font-style: italic;
    font-size: 14px;
    color: var(--gris);
    margin-top: 8px;
}

/* ============================================
   CARDS / SECTIONS
   ============================================ */
.card {
    background: var(--cream-dark);
    padding: 30px;
    margin-bottom: 25px;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(10, 10, 10, 0.1);
}

.card-title {
    font-family: var(--display);
    font-size: 24px;
    color: var(--noir);
    letter-spacing: 1px;
}

.card-link {
    font-size: 11px;
    color: var(--or);
    text-decoration: none;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    transition: gap 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.card-link:hover { gap: 14px; color: var(--or-dark); }

/* ============================================
   MESSAGE LIST
   ============================================ */
.message-list {
    background: var(--cream-dark);
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.message-row {
    display: grid;
    grid-template-columns: 30px 250px 1fr 130px 50px;
    align-items: center;
    gap: 20px;
    padding: 18px 25px;
    border-bottom: 1px solid rgba(10, 10, 10, 0.06);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.message-row:last-child { border-bottom: none; }

.message-row:hover {
    background: var(--cream);
    transform: translateX(5px);
}

.message-row.unread {
    background: rgba(201, 169, 97, 0.08);
    border-left: 3px solid var(--or);
}

.message-row.unread .message-from,
.message-row.unread .message-subject {
    font-weight: 600;
    color: var(--noir);
}

.message-star {
    color: var(--gris-light);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s;
}
.message-star.active { color: var(--or); }

.message-from {
    font-family: var(--serif);
    font-size: 17px;
    color: var(--noir);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.message-from-email {
    font-size: 12px;
    color: var(--gris);
    font-weight: 400;
}

.message-subject {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--noir);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.message-subject-preview {
    color: var(--gris);
    font-weight: 400;
}

.message-date {
    font-size: 12px;
    color: var(--gris);
    text-align: right;
    letter-spacing: 1px;
}

.message-actions {
    text-align: right;
    color: var(--gris);
    font-size: 14px;
}

.message-actions:hover { color: var(--or); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 30px;
}

.empty-state i {
    font-size: 60px;
    color: var(--gris-light);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-family: var(--display);
    font-size: 28px;
    color: var(--noir);
    margin-bottom: 10px;
}

.empty-state p {
    font-family: var(--serif);
    font-style: italic;
    font-size: 16px;
    color: var(--gris);
}

/* ============================================
   MESSAGE VIEW (Single message)
   ============================================ */
.message-view {
    background: var(--cream-dark);
    padding: 40px;
    border-left: 3px solid var(--or);
    margin-bottom: 25px;
}

.message-view-header {
    padding-bottom: 25px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(10, 10, 10, 0.1);
}

.message-view-subject {
    font-family: var(--display);
    font-size: 32px;
    color: var(--noir);
    line-height: 1.2;
    margin-bottom: 20px;
}

.message-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--serif);
    font-size: 15px;
    color: var(--noir);
}

.meta-item i {
    color: var(--or);
    width: 14px;
}

.meta-item a { color: var(--noir); text-decoration: none; }
.meta-item a:hover { color: var(--or); }

.message-view-body {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.7;
    color: var(--noir);
    white-space: pre-wrap;
    margin-bottom: 30px;
}

.message-view-actions {
    display: flex;
    gap: 12px;
    padding-top: 25px;
    border-top: 1px solid rgba(10, 10, 10, 0.1);
    flex-wrap: wrap;
}

/* ============================================
   COMPOSE FORM
   ============================================ */
.compose-form {
    background: var(--cream-dark);
    padding: 40px;
    position: relative;
}

.compose-form::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 60px; height: 60px;
    border-top: 2px solid var(--or);
    border-left: 2px solid var(--or);
}
.compose-form::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 60px; height: 60px;
    border-bottom: 2px solid var(--or);
    border-right: 2px solid var(--or);
}

.form-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 20px;
    margin-bottom: 22px;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.form-row label {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gris);
}

.form-row input {
    width: 100%;
    background: transparent;
    border: none;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--noir);
    outline: none;
    padding: 5px 0;
}

.form-row input::placeholder { color: var(--gris); font-style: italic; }

.form-textarea {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(10, 10, 10, 0.1);
    font-family: var(--serif);
    font-size: 16px;
    color: var(--noir);
    outline: none;
    padding: 18px 20px;
    margin-top: 25px;
    margin-bottom: 25px;
    min-height: 280px;
    resize: vertical;
    line-height: 1.7;
    transition: border-color 0.3s ease;
}

.form-textarea:focus {
    border-color: var(--or);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 18px 25px;
    margin-bottom: 25px;
    font-family: var(--serif);
    font-size: 16px;
    border-left: 3px solid;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert i { font-size: 22px; }

.alert.success {
    background: rgba(76, 175, 80, 0.1);
    border-color: var(--green);
    color: #2e7d32;
}

.alert.error {
    background: rgba(244, 67, 54, 0.1);
    border-color: var(--red);
    color: #c62828;
}

.alert.info {
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--blue);
    color: #1565c0;
}

/* ============================================
   FILTERS / SEARCH
   ============================================ */
.filters-bar {
    background: var(--cream-dark);
    padding: 20px 25px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    background: var(--cream);
    border: 1px solid rgba(10, 10, 10, 0.1);
    font-family: var(--serif);
    font-size: 15px;
    color: var(--noir);
    outline: none;
}

.search-input:focus { border-color: var(--or); }

.filter-tabs {
    display: flex;
    gap: 5px;
}

.filter-tab {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid rgba(10, 10, 10, 0.1);
    color: var(--gris);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-tab:hover, .filter-tab.active {
    background: var(--noir);
    color: var(--cream);
    border-color: var(--noir);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .message-row { grid-template-columns: 30px 1fr 100px 40px; }
    .message-row .message-subject { display: none; }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 80px 25px 40px; }
    .mobile-toggle { display: flex; align-items: center; justify-content: center; }
}

@media (max-width: 700px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 32px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; gap: 8px; }
    .message-row { grid-template-columns: 1fr 70px; gap: 10px; padding: 15px; }
    .message-row .message-star,
    .message-row .message-actions { display: none; }
    .compose-form { padding: 25px; }
    .message-view { padding: 25px; }
}
