/* Cosmic-inspired theme for Mail Panel */
:root {
    --primary-dark: #1a1a2e;
    --primary-purple: #6c63ff;
    --accent-green: #4ade80;
    --accent-pink: #fca5a5;
    --accent-blue: #93c5fd;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

a { color: var(--primary-purple); text-decoration: none; }
a:hover { opacity: 0.85; }

.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    padding: 24px 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 4px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-purple), #9333ea);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), #9333ea);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.user-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.nav-menu { list-style: none; flex: 1; }

.nav-item { margin-bottom: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(147, 51, 234, 0.1));
    color: var(--primary-purple);
    font-weight: 600;
}

.nav-link i { width: 20px; text-align: center; font-size: 15px; }

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.nav-link.logout {
    color: #ef4444;
}

.nav-link.logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

/* Main */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
}

.header-left h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-left p {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
}

.hero-card {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #16213e 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(108, 99, 255, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-card .card-title {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
}

.hero-value {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
}

.hero-meta {
    font-size: 13px;
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 24px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card.green { background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(74, 222, 128, 0.02)); }
.stat-card.pink { background: linear-gradient(135deg, rgba(252, 165, 165, 0.08), rgba(252, 165, 165, 0.02)); }
.stat-card.blue { background: linear-gradient(135deg, rgba(147, 197, 253, 0.08), rgba(147, 197, 253, 0.02)); }
.stat-card.purple { background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), rgba(108, 99, 255, 0.02)); }

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-card.green .stat-icon { background: rgba(74, 222, 128, 0.2); color: #059669; }
.stat-card.pink .stat-icon { background: rgba(252, 165, 165, 0.2); color: #dc2626; }
.stat-card.blue .stat-icon { background: rgba(147, 197, 253, 0.2); color: #2563eb; }
.stat-card.purple .stat-icon { background: rgba(108, 99, 255, 0.2); color: var(--primary-purple); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td { background: var(--bg-light); }

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.sent, .status-badge.success { background: rgba(74, 222, 128, 0.15); color: #059669; }
.status-badge.failed { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.status-badge.queued, .status-badge.pending { background: rgba(251, 191, 36, 0.15); color: #d97706; }

/* Forms */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

textarea { min-height: 120px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-purple {
    background: linear-gradient(135deg, var(--primary-purple), #9333ea);
    color: white;
}

.btn-purple:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-outline {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover { background: var(--border-color); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-full { width: 100%; justify-content: center; }

/* Profile / key cards */
.profile-list { display: grid; gap: 14px; }

.profile-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.profile-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), #9333ea);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.profile-details h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.profile-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 13px;
}

.action-btn:hover {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
}

/* Key display */
.key-display {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.key-value {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-purple);
    word-break: break-all;
    margin: 16px 0;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(74, 222, 128, 0.12);
    color: #065f46;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Filter */
.filter-section {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input { padding-left: 40px; }

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    font-size: 14px;
    min-width: 140px;
}

/* Transaction list */
.transactions-list { max-height: 360px; overflow-y: auto; }

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.transaction-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.transaction-icon.sent { background: rgba(74, 222, 128, 0.15); color: #059669; }
.transaction-icon.failed { background: rgba(252, 165, 165, 0.15); color: #dc2626; }
.transaction-icon.queued { background: rgba(251, 191, 36, 0.15); color: #d97706; }

.transaction-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.transaction-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.page-grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #16213e 50%, #1a1a2e 100%);
    padding: 24px;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    justify-content: center;
}

.login-logo .logo-icon { width: 44px; height: 44px; font-size: 20px; }

.login-card h2 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-row input { width: auto; }

/* Pagination */
.pagination-wrap { margin-top: 20px; }
.pagination-wrap nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination-wrap a, .pagination-wrap span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}
.pagination-wrap span[aria-current="page"] {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

@media (max-width: 1100px) {
    .dashboard-grid, .two-col-grid, .page-grid-1-1 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
}
