@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

/* ==========================================================================
   ULTRA ADS V3.1 — PREMIUM DARK MODE & GLASSMORPHISM DESIGN SYSTEM
   ========================================================================== */

:root {
    /* Premium Brand Colors */
    --brand-primary: #3b82f6;
    --brand-primary-glow: rgba(59, 130, 246, 0.5);
    --brand-secondary: #8b5cf6;
    --brand-accent: #06b6d4;

    /* Semantic Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Dark Mode Palette */
    --bg-base: #020617;
    --bg-surface: rgba(15, 23, 42, 0.6);
    --bg-surface-hover: rgba(30, 41, 59, 0.8);

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders & Dividers */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-strong: rgba(255, 255, 255, 0.15);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 9999px;

    /* Shadows & Glows */
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glow-primary: 0 0 15px var(--brand-primary-glow);
}

/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    min-width: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    word-wrap: break-word;
    overflow-wrap: break-word;
    touch-action: manipulation;

    /* Premium Ambient Background */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08), transparent 40%),
        linear-gradient(rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.9)),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3 Fortive='0.5'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-attachment: fixed;
}

/* Subtle Grid Background Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--border-glass) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-glass) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.3;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ==========================================================================
   GLASSMORPHISM COMPONENTS
   ========================================================================== */

.card {
    background: var(--bg-surface);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-glass);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glass-strong);
}

/* ==========================================================================
   LAYOUT: SIDEBAR & HEADER
   ========================================================================== */

.app-container {
    display: flex;
    flex: 1;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

.sidebar {
    width: 260px;
    background: rgba(2, 6, 23, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg) 0;
    z-index: 100;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Logo Global Style - Zero Tolerance */
.logo-box {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    min-width: 0;
    overflow: hidden;
}

.logo-box img {
    height: 32px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-group {
    padding: var(--spacing-md) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px var(--spacing-lg);
    margin: 4px var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

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

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 3px solid var(--brand-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-left: 0;
}

.nav-item svg {
    margin-right: 12px;
    opacity: 0.7;
    transition: color 0.3s ease;
}

.nav-item.active svg {
    color: var(--brand-primary);
    opacity: 1;
}

/* Header */
.app-header {
    background: rgba(2, 6, 23, 0.7);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    padding-left: max(var(--spacing-lg), env(safe-area-inset-left));
    padding-right: max(var(--spacing-lg), env(safe-area-inset-right));
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.app-header>div {
    min-width: 0;
    flex-shrink: 1;
}

.main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.main-content {
    flex: 1;
    padding: var(--spacing-xl);
    padding-left: max(var(--spacing-xl), env(safe-area-inset-left));
    padding-right: max(var(--spacing-xl), env(safe-area-inset-right));
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* ==========================================================================
   RESPONSIVENESS (Off-canvas Sidebar)
   ========================================================================== */

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%);
        visibility: hidden;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
        background: rgba(2, 6, 23, 0.98);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .hidden-mobile {
        display: none !important;
    }

    /* Mobile Header Adjustments */
    .app-header {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    /* Hamburger Button - Always Visible on Mobile */
    .btn.btn-text.hidden-desktop {
        display: inline-flex !important;
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
        flex-shrink: 0;
    }

    .btn.btn-text.hidden-desktop:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }
}

@media (min-width: 1025px) {
    .hidden-desktop {
        display: none !important;
    }

    /* Desktop: sidebar always visible, adjust main content */
    .main-wrapper {
        margin-left: 0;
    }
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS FOR TABLETS (769px - 1024px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .nav-item {
        padding: 12px 16px;
        font-size: 14px;
    }

    .nav-item svg {
        margin-right: 10px;
    }

    .app-title {
        font-size: 18px;
    }

    .main-content {
        padding: 24px;
    }

    .score-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }

    .metric-card {
        padding: 20px;
    }

    .metric-value {
        font-size: 30px;
    }

    .card {
        padding: 20px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - TABLETS
   ========================================================================== */

@media (max-width: 768px) {
    .app-header {
        min-height: 60px;
        height: auto;
        padding: 8px 16px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        gap: 8px;
    }

    .app-header .logo-box img {
        height: 32px;
    }

    .app-header .flex.items-center.gap-md {
        gap: 8px;
    }

    .main-content {
        padding: 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        min-height: calc(100vh - 60px);
        min-height: calc(100dvh - 60px);
    }

    .score-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-value {
        font-size: 28px;
    }

    .metric-card {
        padding: 16px;
    }

    .grid.col-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .grid.col-3 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        max-height: 85vh;
        align-self: flex-end;
    }

    .modal-overlay {
        align-items: flex-end;
    }

    .btn {
        height: 44px;
        font-size: 14px;
        min-height: 44px;
        padding: 0 14px;
    }

    .form-input,
    .form-select {
        font-size: 16px;
        padding: 14px;
        min-height: 48px;
    }

    .table-full th,
    .table-full td {
        padding: 12px;
        font-size: 13px;
    }

    .text-2xl {
        font-size: 22px;
    }

    .text-3xl {
        font-size: 28px;
    }

    .text-4xl {
        font-size: 36px;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }

    .flex.justify-between {
        flex-wrap: wrap;
        gap: 12px;
    }

    .flex.justify-between.items-center.mb-xl {
        margin-bottom: 20px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        top: 70px;
    }

    .toast {
        max-width: 100%;
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Ensure nav items are visible on mobile sidebar */
    .nav-item {
        padding: 14px 16px;
        font-size: 15px;
    }

    .nav-group {
        padding: 8px 0;
    }

    .sidebar {
        padding-top: max(60px, env(safe-area-inset-top));
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - SMALL PHONES
   ========================================================================== */

@media (max-width: 480px) {
    .app-header {
        min-height: 56px;
        height: auto;
        padding: 8px 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        gap: 8px;
    }

    .app-header .logo-box img {
        height: 28px;
    }

    .app-header .logo-box {
        gap: 8px;
    }

    .main-content {
        padding: 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .sidebar {
        width: 100%;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .metric-card {
        padding: 16px;
    }

    .metric-value {
        font-size: 24px;
    }

    .score-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid.col-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid.col-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn {
        height: 48px;
        font-size: 15px;
        min-height: 48px;
        padding: 0 16px;
    }

    .form-input,
    .form-select {
        font-size: 16px;
        padding: 14px;
        min-height: 48px;
        border-radius: var(--radius-sm);
    }

    .form-group {
        margin-bottom: 16px;
    }

    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }

    .table-full th,
    .table-full td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .text-2xl {
        font-size: 20px;
    }

    .text-3xl {
        font-size: 24px;
    }

    .text-4xl {
        font-size: 30px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 17px;
    }

    h3 {
        font-size: 15px;
    }

    .flex.justify-between.items-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .flex.justify-between.items-center .btn {
        width: 100%;
    }

    .nav-item {
        font-size: 14px;
        padding: 14px var(--spacing-lg);
    }

    .app-title {
        font-size: 17px;
    }

    .tag {
        padding: 3px 8px;
        font-size: 10px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        top: 68px;
    }

    .toast {
        padding: 10px 16px;
        font-size: 13px;
        max-width: 100%;
    }

    .avatar-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - EXTRA SMALL PHONES (320px)
   ========================================================================== */

@media (max-width: 360px) {
    .app-header {
        min-height: 52px;
        height: auto;
        padding: 8px 8px;
    }

    .app-header .logo-box img {
        height: 24px;
    }

    .main-content {
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .card {
        padding: 14px;
    }

    .metric-value {
        font-size: 22px;
    }

    .btn {
        height: 46px;
        font-size: 14px;
    }

    .form-input,
    .form-select {
        font-size: 16px;
        padding: 12px;
        min-height: 46px;
    }

    .table-full th,
    .table-full td {
        padding: 8px 6px;
        font-size: 11px;
    }

    h1 {
        font-size: 18px;
    }

    h2 {
        font-size: 16px;
    }

    h3 {
        font-size: 14px;
    }

    .text-2xl {
        font-size: 18px;
    }

    .text-3xl {
        font-size: 22px;
    }

    .text-4xl {
        font-size: 26px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - LANDSCAPE PHONES
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        min-height: 48px;
        height: auto;
    }

    .main-content {
        padding: 12px 20px;
    }

    .score-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 12px;
    }

    .metric-card {
        padding: 16px;
    }

    .metric-value {
        font-size: 22px;
        margin: 4px 0;
    }

    .modal-content {
        max-height: 95vh;
    }

    .sidebar {
        width: 260px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - LARGE TABLETS & DESKTOPS
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }

    .score-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .grid.col-2 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .grid.col-3 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - 4K / ULTRA WIDE
   ========================================================================== */

@media (min-width: 2000px) {
    .main-content {
        max-width: 1800px;
    }

    .score-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* ==========================================================================
   TOUCH & MOBILE SPECIFIC
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .nav-item {
        padding: 14px var(--spacing-lg);
    }

    .form-input,
    .form-select {
        min-height: 48px;
        font-size: 16px;
    }

    .card:hover {
        transform: none;
    }
}

/* ==========================================================================
   SAFE AREA UTILITIES
   ========================================================================== */

.safe-bottom {
    padding-bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
}

.safe-left {
    padding-left: max(var(--spacing-md), env(safe-area-inset-left));
}

.safe-right {
    padding-right: max(var(--spacing-md), env(safe-area-inset-right));
}

.safe-top {
    padding-top: max(var(--spacing-md), env(safe-area-inset-top));
}

/* ==========================================================================
   UI COMPONENTS: BUTTONS, TABLES, SKELETONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 8px;
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass-strong);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
}

.btn-text:hover {
    color: var(--text-primary);
}

/* Skeleton Pulse */
.skeleton {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: skeleton-pulse 1.5s infinite linear;
}

@keyframes skeleton-pulse {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Data Grid (Table) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.1);
}

.table-full {
    width: 100%;
    border-collapse: collapse;
}

.table-full th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
}

.table-full td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Metrics Dashboard */
.score-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 20px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin: 8px 0;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass-strong);
    padding: 12px;
    border-radius: var(--radius-sm);
    color: white;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    width: 95%;
    max-width: 650px;
    border-radius: var(--radius-lg);
    padding: 32px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-glass-strong);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Badges */
.tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tag-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.tag-green {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.tag-yellow {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.tag-red {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass-strong);
    border-radius: 10px;
}

/* Utility */
.flex {
    display: flex;
    min-width: 0;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-md {
    gap: 16px;
}

.grid {
    display: grid;
}

.col-2 {
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 24px;
}

.col-3 {
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 24px;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Margin */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.mt-xs {
    margin-top: var(--spacing-xs);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mt-xl {
    margin-top: var(--spacing-xl);
}

.mt-auto {
    margin-top: auto;
}

.mb-xs {
    margin-bottom: var(--spacing-xs);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.mb-xl {
    margin-bottom: var(--spacing-xl);
}

.ml-auto {
    margin-left: auto;
}

.mr-auto {
    margin-right: auto;
}

/* Padding */
.p-0 {
    padding: 0;
}

.p-xs {
    padding: var(--spacing-xs);
}

.p-sm {
    padding: var(--spacing-sm);
}

.p-md {
    padding: var(--spacing-md);
}

.p-lg {
    padding: var(--spacing-lg);
}

.p-xl {
    padding: var(--spacing-xl);
}

.px-md {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.py-md {
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-md);
}

/* Text */
.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.text-lg {
    font-size: 18px;
}

.text-xl {
    font-size: 24px;
}

.text-2xl {
    font-size: 28px;
}

.text-3xl {
    font-size: 36px;
}

.text-4xl {
    font-size: 48px;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

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

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

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

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

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

.text-left {
    text-align: left;
}

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

.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 700;
}

.font-light {
    font-weight: 300;
}

.text-uppercase {
    text-transform: uppercase;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Display & Layout */
.hidden {
    display: none;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.items-stretch {
    align-items: stretch;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.gap-xs {
    gap: var(--spacing-xs);
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-lg {
    gap: var(--spacing-lg);
}

.gap-xl {
    gap: var(--spacing-xl);
}

/* Borders */
.border {
    border: 1px solid var(--border-glass);
}

.border-t {
    border-top: 1px solid var(--border-glass);
}

.border-b {
    border-bottom: 1px solid var(--border-glass);
}

.border-l {
    border-left: 1px solid var(--border-glass);
}

.border-r {
    border-right: 1px solid var(--border-glass);
}

.border-glass {
    border-color: var(--border-glass);
}

.border-glass-strong {
    border-color: var(--border-glass-strong);
}

.border-t-red {
    border-top: 3px solid var(--danger);
}

.border-t-blue {
    border-top: 3px solid var(--brand-primary);
}

.border-t-green {
    border-top: 3px solid var(--success);
}

.border-t-yellow {
    border-top: 3px solid var(--warning);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: var(--radius-pill);
}

/* Background */
.bg-surface {
    background: var(--bg-surface);
}

.bg-transparent {
    background: transparent;
}

/* Object */
.object-contain {
    object-fit: contain;
}

.object-cover {
    object-fit: cover;
}

/* Overflow */
.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

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

/* Position */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.sticky {
    position: sticky;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* Transitions */
.transition {
    transition: all 0.2s ease;
}

/* Avatar */
.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-glass);
    backdrop-filter: blur(16px);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
    pointer-events: auto;
    max-width: 360px;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
}

.toast.toast-info {
    border-left: 3px solid var(--brand-primary);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ==========================================================================
   SCORE & GRADE STYLES - FASE 3
   ========================================================================== */

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.score-high {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.score-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-low {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
}

.grade-a,
.grade-aplus {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.grade-b {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.grade-c {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.grade-d {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
}

.grade-f {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* ==========================================================================
   KEYWORD SUGGESTIONS STYLES - FASE 3
   ========================================================================== */

.keywords-grid {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.keyword-suggestion {
    padding: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    transition: all 0.2s ease;
}

.keyword-suggestion:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-glass-strong);
    transform: translateY(-2px);
}

.keyword-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.keyword-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.keyword-stats .stat {
    color: var(--text-secondary);
}

/* ==========================================================================
   OPTIMIZATION SUGGESTIONS STYLES - FASE 3
   ========================================================================== */

.optimization-card {
    padding: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    margin-bottom: 12px;
}

.optimization-card.priority-high {
    border-left: 3px solid var(--danger);
}

.optimization-card.priority-medium {
    border-left: 3px solid var(--warning);
}

.optimization-card.priority-low {
    border-left: 3px solid var(--success);
}

.optimization-type {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.optimization-message {
    font-weight: 500;
    color: var(--text-primary);
}

.optimization-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   ANALYTICS DASHBOARD WIDGETS - FASE 3
   ========================================================================== */

.analytics-card {
    padding: 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.analytics-metric {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-metric-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.average-score-card {
    text-align: center;
    padding: 24px;
}

.average-score-value {
    font-size: 48px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.average-score-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ==========================================================================
   PASSWORD STRENGTH STYLES
   ========================================================================== */
.password-input-wrapper .form-input {
    padding-right: 44px;
}

.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-input {
    width: 100%;
    padding-right: 44px;
    border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.password-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.password-strength-meter {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border-glass);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.password-strength-text {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.password-requirements {
    margin-top: 8px;
    list-style: none;
    padding: 0;
}

.requirement-item {
    display: flex;
    align-items: center;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.password-requirements-title {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.req-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.req-icon svg {
    transition: all 0.25s ease;
}

.requirement-item.met .req-icon {
    color: var(--success);
}

.requirement-item.met .req-icon svg circle {
    fill: var(--success);
    stroke: var(--success);
}

.requirement-item.met .req-icon svg .check-path {
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Animation for bars when they activate */
@key-strength-bar-fill {
    from { width: 0%; }
    to { width: 100%; }
}

/* We'll set the width via JS, but we can have a transition */
.strength-bar {
    transition: width 0.3s ease, background 0.3s ease;
}