/* 
 * Modern SaaS Design System - Appberry.Store (Enhanced)
 * Identity: UI/UX Designer & Frontend Quality Architect
 * Version: 2.0.0 (Glassmorphism + Dark Mode Ready)
 */

:root {
    /* --- Base Color System (HSL) --- */
    --base-hue: 220;
    /* Indigo/Slate Hue */
    --primary-hue: 245;
    /* Vibrant Indigo */

    /* Brand Colors */
    --primary-color: hsl(var(--primary-hue), 80%, 60%);
    /* #6366f1 Indigo 500 */
    --primary-hover: hsl(var(--primary-hue), 75%, 50%);
    /* #4f46e5 Indigo 600 */
    --primary-subtle: hsl(var(--primary-hue), 80%, 96%);
    /* Very light tint */

    --secondary-color: hsl(var(--base-hue), 15%, 45%);
    /* Slate 500 */
    --accent-color: #06B6D4;
    /* Cyan 500 */

    /* Semantic Colors */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;

    /* Backgrounds */
    --bg-body: #F8FAFC;
    /* Slate 50 */
    --bg-surface: #FFFFFF;
    /* White */
    --bg-surface-alt: #F1F5F9;
    /* Slate 100 */
    --bg-glass: rgba(255, 255, 255, 0.7);

    /* Typography */
    --text-main: #0F172A;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94A3B8;
    /* Slate 400 */

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'inter', sans-serif;

    /* Borders & Spacing */
    --border-color: #E2E8F0;
    /* Slate 200 */
    --border-radius-lg: 1rem;
    /* 16px */
    --border-radius: 0.75rem;
    /* 12px */
    --border-radius-sm: 0.5rem;
    /* 8px */

    /* Effects */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    --backdrop-blur: blur(12px);

    /* Animation */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Setup */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-wrap: balance;
    /* Modern nicer wrapping */
}

/* Responsive Headings */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .display-4 {
        font-size: 2.5rem;
    }

    .display-5 {
        font-size: 2rem;
    }
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.content-wrapper {
    padding-top: 5rem;
    /* Header clearance */
    width: 100%;
    max-width: 100%;
    /* Changed from 1440px to ensure fluid containers work */
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .content-wrapper {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1440px) {
    .content-wrapper {
        max-width: 1440px;
    }
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-glass);
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
    /* Subtle primary hint */
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    /* Increased for minimum 44px touch target */
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition: all 0.2s var(--ease-out);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    /* Ensure strictly 44px minimum */
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-alt);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-subtle);
    outline: none;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--primary-color);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #4338ca);
}

/* Navbar specific overrides for glass effect */
header.fixed-top,
.qubits-navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-out);
}

/* Nav link base */
.cool-link {
    position: relative;
    padding: 0.5rem 1rem;
    transition: all 0.2s var(--ease-out);
    font-size: 0.95rem;
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    font-weight: 500;
}

.cool-link:hover,
.cool-link.active,
.nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary-color);
}

.cool-link i {
    font-size: 1.1em;
    width: 1.4em;
    text-align: center;
    margin-right: 0.25rem;
}

/* Dropdown sizing and animation */
.scrollable-dropdown {
    min-width: 240px;
    max-width: 420px;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    animation: fadeInUp 0.2s var(--ease-out);
}

.dropdown-item {
    padding: 0.6rem 1rem;
    border-radius: 4px;
    margin: 0.25rem;
    width: auto;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background-color: var(--primary-subtle);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 1.5rem;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.8;
}

/* Brand placeholder */
.brand-placeholder {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    font-size: 1.25rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s var(--ease-out) forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .content-wrapper {
        padding-top: 4.5rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Stack buttons on mobile if within a gap group */
    .d-flex.gap-2.flex-wrap,
    .d-flex.gap-3.flex-wrap {
        flex-direction: column !important;
    }

    .d-flex.gap-2.flex-wrap>*,
    .d-flex.gap-3.flex-wrap>* {
        width: 100% !important;
    }

    /* Small table font for better fit */
    .table {
        font-size: 0.875rem;
    }

    /* Hide non-essential columns by default using utilities in HTML, 
       but here's a global helper for common patterns */
    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-on-mobile {
        display: table-cell !important;
    }
}

/* Modal Responsiveness */
.modal-dialog-centered.modal-dialog-scrollable {
    height: calc(100% - 1rem);
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: var(--border-radius);
    }
}

/* Validation States */
.field-validation-valid {
    display: none;
}

.field-validation-error {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.input-validation-error {
    border-color: var(--danger-color) !important;
}

.input-validation-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Nested Dropdown Support (Added for multi-level menus) */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu>.dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -5px;
    margin-left: -1px;
    display: none;
}

.dropdown-submenu:hover>.dropdown-menu {
    display: block;
}

.dropdown-submenu>a::after {
    content: "\F285";
    /* Bootstrap Icon Chevron Right */
    font-family: "bootstrap-icons";
    float: right;
    margin-top: 4px;
    font-size: 0.8em;
}