/* RoyalMoney.in - Premium Email Client */
:root {
    --rm-primary: #1a237e;
    --rm-secondary: #283593;
    --rm-accent: #c5a028;
    --rm-gold: #d4a820;
    --rm-dark: #0d1321;
    --rm-sidebar-width: 220px;
    --rm-header-height: 56px;
    --rm-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --rm-bg: #f6f8fc;
    --rm-border: #e8eaed;
    --rm-sidebar-bg: #1e2a3a;
}
* { box-sizing: border-box; }
body {
    font-family: var(--rm-font);
    background: var(--rm-bg);
    color: #333;
    min-height: 100vh;
    margin: 0;
}

/* ============================================
   LOGIN
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--rm-primary) 0%, var(--rm-dark) 100%);
    padding: 1rem;
}
.login-card {
    background: #fff; border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 420px; padding: 2.5rem;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo h1 { font-size: 2rem; font-weight: 700; color: var(--rm-primary); margin: 0; }
.login-logo span { color: var(--rm-gold); }
.login-logo p { color: #666; font-size: 0.875rem; margin-top: 0.25rem; }

/* ============================================
   APP LAYOUT
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR — Dark professional
   ============================================ */
.sidebar {
    width: var(--rm-sidebar-width);
    background: var(--rm-sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}
.sidebar-brand {
    padding: 1.25rem 1.25rem 0.5rem;
}
.sidebar-brand h2 {
    font-size: 1.2rem; font-weight: 700; margin: 0;
    color: #fff;
}
.sidebar-brand h2 span { color: var(--rm-gold); }
.sidebar-brand small {
    font-size: 0.6rem; color: rgba(255,255,255,0.5);
    display: block; margin-top: 2px; letter-spacing: 0.5px;
}

/* Compose */
.sidebar-compose { padding: 1rem 0.75rem; }
.sidebar-compose .btn-compose {
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%; padding: 0.6rem 1rem;
    background: var(--rm-gold); color: #fff;
    border: none; border-radius: 8px;
    font-size: 0.82rem; font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.sidebar-compose .btn-compose:hover {
    background: #b8911a;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(212,168,32,0.3);
}

/* Nav */
.sidebar-nav { flex: 1; padding: 0.25rem 0; }
.sidebar-section {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 1px; color: rgba(255,255,255,0.35); font-weight: 600;
}
.sidebar-nav .nav-item { padding: 0 0.5rem; margin-bottom: 1px; }
.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    display: flex; align-items: center; gap: 0.7rem;
    font-size: 0.82rem;
    transition: all 0.15s;
    text-decoration: none;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08); color: #fff;
}
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.12); color: #fff; font-weight: 500;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 18px; text-align: center; opacity: 0.8; }
.sidebar-nav .nav-link.active i { opacity: 1; }
.sidebar-nav .nav-link .badge {
    margin-left: auto; font-size: 0.6rem;
    padding: 2px 6px; border-radius: 10px;
    background: var(--rm-gold); color: #fff;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--rm-sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* ============================================
   TOP HEADER
   ============================================ */
.top-header {
    background: #fff;
    height: var(--rm-header-height);
    display: flex; align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--rm-border);
    position: sticky; top: 0; z-index: 100;
    gap: 1rem;
}
.top-header .page-title {
    font-size: 1.05rem; font-weight: 600; color: var(--rm-dark); margin: 0;
    white-space: nowrap; min-width: fit-content;
}
.top-header .header-search {
    flex: 1; max-width: 520px; position: relative;
    margin: 0 1rem;
}
.top-header .header-search input {
    width: 100%; height: 38px;
    border: 1px solid #e0e0e0; background: #f8f9fa;
    border-radius: 8px; padding: 0 1rem 0 2.5rem;
    font-size: 0.85rem; color: #333;
    transition: all 0.2s;
}
.top-header .header-search input:focus {
    outline: none; background: #fff;
    border-color: var(--rm-primary);
    box-shadow: 0 1px 6px rgba(26,35,126,0.1);
}
.top-header .header-search .search-icon {
    position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
    color: #999; font-size: 0.85rem; pointer-events: none;
}
.top-header .user-info { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.top-header .user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--rm-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.82rem; cursor: pointer;
}

/* Mobile toggle */
.sidebar-toggle {
    display: none; background: none; border: none;
    font-size: 1.25rem; color: var(--rm-dark); cursor: pointer; padding: 0.25rem;
}

/* Content area (for admin/dashboard pages) */
.content-area { padding: 1.5rem; }

/* ============================================
   INBOX TOOLBAR
   ============================================ */
.inbox-toolbar {
    display: flex; align-items: center;
    padding: 0.35rem 1.25rem;
    border-bottom: 1px solid #f1f3f4;
    min-height: 40px;
    gap: 0.5rem;
}
.inbox-toolbar .toolbar-left { display: flex; align-items: center; gap: 0.25rem; }
.inbox-toolbar .toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.toolbar-btn {
    width: 30px; height: 30px;
    border-radius: 50%; border: none; background: transparent;
    color: #666; display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; cursor: pointer; transition: background 0.15s;
    text-decoration: none;
}
.toolbar-btn:hover { background: #eee; color: #333; }
.toolbar-info { font-size: 0.72rem; color: #999; white-space: nowrap; }

/* ============================================
   EMAIL LIST — Professional compact rows
   ============================================ */
.email-list { list-style: none; padding: 0; margin: 0; }

.email-item {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    height: 50px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
    gap: 14px;
}
.email-item:hover { background: #f5f7fa; }
.email-item:last-child { border-bottom: none; }

/* Unread state */
.email-item.unread {
    background: #eef3fd;
}
.email-item.unread:hover { background: #e5edfc; }
.email-item.unread .em-sender { font-weight: 700; color: #111; }
.email-item.unread .em-subject { font-weight: 600; color: #111; }
.email-item.unread .em-date { font-weight: 600; color: #1a237e; }

/* Unread left indicator */
.email-item.unread::before {
    content: '';
    position: absolute; left: 0; top: 12px; bottom: 12px;
    width: 3px; background: var(--rm-primary);
    border-radius: 0 2px 2px 0;
}

/* Avatar */
.em-avatar {
    width: 30px; height: 30px; min-width: 30px;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Sender */
.em-sender {
    width: 140px; min-width: 110px;
    font-size: 0.82rem; color: #333;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Subject + Preview inline */
.em-body {
    flex: 1; min-width: 0;
    display: flex; align-items: baseline;
    overflow: hidden;
    gap: 8px;
}
.em-subject {
    font-size: 0.82rem; color: #222;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex-shrink: 1;
    max-width: 45%;
}
.em-preview {
    font-size: 0.8rem; color: #999;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1;
}

/* Attachment */
.em-attach {
    color: #aaa; font-size: 0.85rem; flex-shrink: 0;
}

/* Date — far right */
.em-date {
    font-size: 0.73rem; color: #888;
    white-space: nowrap; flex-shrink: 0;
    min-width: 110px; text-align: right;
}

/* Pagination */
.inbox-pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 1.25rem; border-top: 1px solid #f1f3f4;
    font-size: 0.72rem; color: #999;
}
.pag-btn {
    width: 28px; height: 28px;
    border-radius: 50%; border: 1px solid #ddd; background: #fff;
    display: flex; align-items: center; justify-content: center;
    color: #555; font-size: 0.75rem; cursor: pointer;
    text-decoration: none; transition: all 0.15s;
}
.pag-btn:hover { background: #f1f3f4; border-color: #bbb; color: #222; }

/* Empty state */
.empty-state {
    text-align: center; padding: 5rem 2rem; color: #bbb;
}
.empty-state i { font-size: 3rem; margin-bottom: 0.75rem; display: block; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* ============================================
   EMAIL VIEW
   ============================================ */
.email-view-header { border-bottom: 1px solid var(--rm-border); padding-bottom: 1rem; margin-bottom: 1rem; }
.email-view-header h4 { font-weight: 600; margin-bottom: 0.75rem; font-size: 1.2rem; color: #111; }
.email-meta { font-size: 0.85rem; color: #555; }
.email-meta p { margin-bottom: 0.2rem; }
.email-body { padding: 1.5rem 0; line-height: 1.7; font-size: 0.9rem; color: #333; }
.email-body img { max-width: 100%; height: auto; }

/* Compose */
.compose-form .form-label { font-weight: 500; font-size: 0.82rem; }

/* ============================================
   ADMIN DASHBOARD COMPONENTS
   ============================================ */
.stat-card {
    background: #fff; border-radius: 12px; padding: 1.25rem;
    border: 1px solid #e8e8e8; transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--rm-dark); }
.stat-card .stat-label { font-size: 0.8rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }

.table-card {
    background: #fff; border-radius: 12px; border: 1px solid #e8e8e8; overflow: hidden;
}
.table-card .card-header {
    background: #fff; border-bottom: 1px solid #e8e8e8;
    padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between;
}
.table-card .card-header h5 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.data-table { margin: 0; }
.data-table th {
    background: #f8f9fa; font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 0.5px; color: #555; font-weight: 600;
    padding: 0.65rem 1rem; border-bottom: 2px solid #e8e8e8;
}
.data-table td { padding: 0.65rem 1rem; vertical-align: middle; font-size: 0.82rem; }

.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }
.badge-connected { background: #e8f5e9; color: #2e7d32; }
.badge-disconnected { background: #fce4ec; color: #c62828; }
.badge-untested { background: #fff3e0; color: #e65100; }

.quick-action-btn {
    border: 1px solid #e0e0e0; border-radius: 10px; padding: 1rem;
    text-align: center; text-decoration: none; color: var(--rm-dark);
    transition: all 0.2s; display: block;
}
.quick-action-btn:hover {
    border-color: var(--rm-primary); background: #f0f4ff;
    color: var(--rm-primary); transform: translateY(-2px);
}
.quick-action-btn i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }

.form-card {
    background: #fff; border-radius: 12px;
    border: 1px solid #e8e8e8; padding: 1.5rem;
}

.flash-message {
    border-radius: 8px; padding: 0.75rem 1rem;
    margin-bottom: 1rem; font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
.sidebar-overlay {
    display: none; position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
}
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .sidebar-overlay.show { display: block; }
}
@media (max-width: 768px) {
    .em-sender { width: 90px; min-width: 80px; }
    .em-preview { display: none; }
    .em-date { min-width: 80px; }
    .em-avatar { width: 26px; height: 26px; min-width: 26px; font-size: 0.65rem; }
    .top-header .header-search { margin: 0 0.5rem; }
}
@media (max-width: 576px) {
    .content-area { padding: 1rem; }
    .login-card { padding: 1.5rem; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .email-item { padding: 0 0.75rem; height: 46px; gap: 10px; }
    .em-sender { width: 70px; min-width: 70px; font-size: 0.75rem; }
    .em-subject { font-size: 0.75rem; }
    .em-date { min-width: 65px; font-size: 0.65rem; }
    .em-avatar { display: none; }
    .top-header { padding: 0 0.75rem; }
    .top-header .page-title { font-size: 0.9rem; }
    .inbox-toolbar { padding: 0.35rem 0.75rem; }
}
