/**
 * InboxDefender - Main Stylesheet
 *
 * Modern AdminLTE-inspired design with custom color palette
 */

/* ============================================
   CSS Variables - Modern Color Palette
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #6366f1;          /* Indigo */
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    /* Secondary/Accent Colors */
    --accent: #06b6d4;           /* Cyan */
    --accent-dark: #0891b2;

    /* Status Colors */
    --success: #10b981;          /* Emerald */
    --warning: #f59e0b;          /* Amber */
    --danger: #ef4444;           /* Red */
    --info: #3b82f6;             /* Blue */
    --orange: #f97316;           /* Orange */

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Sidebar Colors */
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f1f5f9;
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-active-border: var(--primary);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-700);
    background-color: var(--gray-100);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   Layout Structure
   ============================================ */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    margin-right: 12px;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.sidebar-brand span {
    font-size: 10px;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-section {
    padding: 0 16px;
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    padding: 8px 12px;
    margin-bottom: 4px;
}

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--sidebar-text);
    border-radius: 6px;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    margin: 0 8px;
}

.nav-link:hover {
    color: var(--sidebar-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--sidebar-text-hover);
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
}

.nav-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.nav-link .badge {
    margin-left: auto;
    font-size: 10px;
    padding: 3px 6px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.breadcrumb {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    padding: 0 8px;
    color: var(--gray-400);
}

.breadcrumb-item a {
    color: var(--gray-500);
}

.breadcrumb-item.active {
    color: var(--gray-700);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.header-user:hover {
    background-color: var(--gray-100);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-800);
}

.user-role {
    font-size: 11px;
    color: var(--gray-500);
}

/* Content Area */
.content {
    flex: 1;
    padding: 24px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.content-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-800);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    display: flex;
    align-items: center;
    padding: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 16px;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.stat-icon.info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.1); color: var(--orange); }

.stat-content h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    line-height: 1.2;
}

.stat-content p {
    font-size: 13px;
    color: var(--gray-500);
    margin: 4px 0 0 0;
}

.stat-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background-color: var(--gray-50);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table-responsive {
    overflow-x: auto;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 8px;
}

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

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background-color: #059669;
    color: #fff;
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
    color: #fff;
}

.btn-warning {
    background-color: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background-color: #d97706;
    color: #fff;
}

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

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: #fff;
}

.btn-ghost {
    background-color: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background-color: var(--gray-100);
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bg-primary { background-color: var(--primary) !important; color: #fff; }
.bg-success { background-color: var(--success) !important; color: #fff; }
.bg-warning { background-color: var(--warning) !important; color: #fff; }
.bg-danger { background-color: var(--danger) !important; color: #fff; }
.bg-info { background-color: var(--info) !important; color: #fff; }
.bg-secondary { background-color: var(--gray-500) !important; color: #fff; }
.bg-orange { background-color: var(--orange) !important; color: #fff; }

.text-dark { color: var(--gray-800) !important; }

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert i {
    font-size: 18px;
    margin-top: 2px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted { color: var(--gray-500) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

.w-100 { width: 100% !important; }

.text-center { text-align: center !important; }
.text-end { text-align: right !important; }

.fw-bold { font-weight: 600 !important; }
.fs-sm { font-size: 13px !important; }

/* ============================================
   Grid System (Simple)
   ============================================ */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col {
    flex: 1;
    padding: 0 12px;
}

.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 12px; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; padding: 0 12px; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding: 0 12px; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 12px; }

@media (max-width: 992px) {
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 768px) {
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

/* ============================================
   Score Indicator
   ============================================ */
.score-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.score-bar {
    width: 60px;
    height: 6px;
    background-color: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.score-bar-fill.success { background-color: var(--success); }
.score-bar-fill.warning { background-color: var(--warning); }
.score-bar-fill.orange { background-color: var(--orange); }
.score-bar-fill.danger { background-color: var(--danger); }

.score-value {
    font-size: 13px;
    font-weight: 600;
    min-width: 30px;
}

/* ============================================
   Dropdowns
   ============================================ */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--gray-700);
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
}

.dropdown-item i {
    width: 20px;
    margin-right: 8px;
    color: var(--gray-500);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--gray-200);
    margin: 8px 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   Login Page
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.auth-logo span {
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--gray-500);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}
