/**
 * CardX - Vuexy Theme
 * Modern SaaS Dashboard
 * Primary Color: Purple (#7367F0)
 */

/* ===================================
   VARIABLES & ROOT
   =================================== */
:root {
    /* Brand Colors */
    --primary: #7367F0;
    --primary-dark: #5E50EE;
    --primary-light: #9E95F5;

    --secondary: #82868B;
    --success: #28C76F;
    --danger: #EA5455;
    --warning: #FF9F43;
    --info: #00CFE8;

    --cardx-blue: #1B4F8C;
    --cardx-orange: #FF6B35;

    /* Background Colors */
    --body-bg: #F8F8F8;
    --card-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --navbar-bg: #FFFFFF;

    /* Text Colors */
    --text-primary: #5E5873;
    --text-secondary: #B9B9C3;
    --text-muted: #B9B9C3;
    --heading-color: #5E5873;

    /* Borders & Shadows */
    --border-color: #EBE9F1;
    --shadow-sm: 0 2px 6px 0 rgba(115, 103, 240, 0.1);
    --shadow-md: 0 4px 24px 0 rgba(34, 41, 47, 0.1);
    --shadow-lg: 0 5px 25px rgba(34, 41, 47, 0.15);

    /* Spacing */
    --content-padding: 2rem;
    --card-padding: 1.5rem;

    /* Transitions */
    --transition: all 0.3s ease;
}

/* ===================================
   GLOBAL STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--text-primary);
    background-color: var(--body-bg);
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

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

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

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

.main-content {
    flex: 1;
    padding: var(--content-padding);
    margin-top: 70px;
    /* Navbar height */
}

.container-fluid {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===================================
   NAVBAR (Horizontal Top)
   =================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--navbar-bg);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.navbar-logo {
    height: 45px;
    margin-right: 2rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0.5rem;
    flex: 1;
}

.navbar-menu .nav-item {
    position: relative;
}

.navbar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
}

.navbar-menu .nav-link:hover {
    background: rgba(115, 103, 240, 0.08);
    color: var(--primary);
}

.navbar-menu .nav-link.active {
    background: var(--primary);
    color: white;
}

.navbar-menu .nav-link i {
    font-size: 1.1rem;
}

/* Dropdown */
.nav-item.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 0.5rem 0;
    display: none;
    z-index: 1001;
}

.nav-item.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.dropdown-menu .dropdown-item:hover {
    background: rgba(115, 103, 240, 0.08);
    color: var(--primary);
}

.dropdown-menu .dropdown-item i {
    font-size: 1rem;
    width: 20px;
}

/* User Menu (Right Side) */
.navbar-user-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background: rgba(115, 103, 240, 0.08);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

/* ===================================
   CARDS
   =================================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: var(--card-padding);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-color);
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.card-body {
    padding: 0;
}

.card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Stats Cards */
.stats-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem;
}

.stats-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stats-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stats-icon.primary {
    background: rgba(115, 103, 240, 0.12);
    color: var(--primary);
}

.stats-icon.success {
    background: rgba(40, 199, 111, 0.12);
    color: var(--success);
}

.stats-icon.warning {
    background: rgba(255, 159, 67, 0.12);
    color: var(--warning);
}

.stats-icon.danger {
    background: rgba(234, 84, 85, 0.12);
    color: var(--danger);
}

.stats-icon.info {
    background: rgba(0, 207, 232, 0.12);
    color: var(--info);
}

.stats-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.stats-trend.up {
    color: var(--success);
}

.stats-trend.down {
    color: var(--danger);
}

/* ===================================
   BUTTONS
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(115, 103, 240, 0.4);
}

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

.btn-success:hover:not(:disabled) {
    background: #24B263;
    transform: translateY(-2px);
}

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

.btn-danger:hover:not(:disabled) {
    background: #E73D3E;
    transform: translateY(-2px);
}

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

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

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 8px;
}

/* ===================================
   FORMS
   =================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--heading-color);
    font-size: 0.9375rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

.table thead th {
    background: rgba(115, 103, 240, 0.08);
    color: var(--heading-color);
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: rgba(115, 103, 240, 0.04);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===================================
   BADGES
   =================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
}

.badge-primary {
    background: rgba(115, 103, 240, 0.12);
    color: var(--primary);
}

.badge-success {
    background: rgba(40, 199, 111, 0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 159, 67, 0.12);
    color: var(--warning);
}

.badge-danger {
    background: rgba(234, 84, 85, 0.12);
    color: var(--danger);
}

.badge-info {
    background: rgba(0, 207, 232, 0.12);
    color: var(--info);
}

/* ===================================
   ALERTS
   =================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert i {
    font-size: 1.25rem;
}

.alert-success {
    background: rgba(40, 199, 111, 0.12);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: rgba(255, 159, 67, 0.12);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.alert-danger {
    background: rgba(234, 84, 85, 0.12);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: rgba(0, 207, 232, 0.12);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* ===================================
   GRID SYSTEM
   =================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col {
    flex: 1;
    padding: 0 0.75rem;
}

.col-1 {
    flex: 0 0 8.333333%;
    max-width: 8.333333%;
}

.col-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-9 {
    flex: 0 0 75%;
    max-width: 75%;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* ===================================
   UTILITIES
   =================================== */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.5rem !important;
}

.mb-2 {
    margin-bottom: 1rem !important;
}

.mb-3 {
    margin-bottom: 1.5rem !important;
}

.mb-4 {
    margin-bottom: 2rem !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 0.5rem !important;
}

.mt-2 {
    margin-top: 1rem !important;
}

.mt-3 {
    margin-top: 1.5rem !important;
}

.mt-4 {
    margin-top: 2rem !important;
}

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

.text-right {
    text-align: right !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-1 {
    gap: 0.5rem !important;
}

.gap-2 {
    gap: 1rem !important;
}

.gap-3 {
    gap: 1.5rem !important;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 991px) {
    .navbar {
        padding: 0 0.75rem;
    }

    .navbar-brand {
        margin-right: auto;
        /* Push user menu to the right */
    }

    .navbar-logo {
        height: 35px;
        width: 120px !important;
        /* Force smaller size on mobile */
        margin-right: 0;
    }

    .navbar-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 0;
        box-shadow: var(--shadow-md);
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .navbar-menu.active {
        left: 0;
    }

    .navbar-menu .nav-link {
        width: 100%;
        justify-content: flex-start;
        border-radius: 0;
    }

    .mobile-menu-toggle {
        display: block;
        padding: 0.5rem;
        margin-right: 0.5rem;
    }

    .navbar-user-menu {
        gap: 0.5rem;
    }

    .quota-badge {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .quota-badge span:last-child {
        display: none;
        /* Hide 'credits' text on mobile */
    }

    .user-profile {
        padding: 0.4rem;
    }

    .main-content {
        padding: 1rem;
    }

    .col-3,
    .col-4,
    .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .user-info {
        display: none;
    }

    .stats-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}