:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --input-bg: #334155;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --font-family: 'Inter', sans-serif;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%), radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%), radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #fff;
}

/* Auth Pages */
.auth-content {
    max-width: 450px;
    margin: 4rem auto;
    padding: 2.5rem;
    background-color: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-content legend {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #fff;
    border-bottom: none;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
    /* For password toggle positioning */
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

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

.form-control.is-invalid {
    border-color: var(--error-color);
    background-image: none;
    /* Remove default bootstrap validation icon if present */
}

.invalid-feedback {
    display: block;
    /* Force display */
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Slider Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  margin: 0;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.2);
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-color);
}
input:checked + .slider:before {
  transform: translateX(16px);
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
    transition: color 0.2s;
}

.password-toggle-icon:hover {
    color: #fff;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline-info {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.btn-outline-info:hover {
    opacity: 0.9;
}

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

.btn-outline-purple {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.btn-outline-purple:hover {
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
}

.btn-outline-warning {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.btn-outline-warning:hover {
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.btn-ghost {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
}

.btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: none;
}

.w-auto {
    width: auto !important;
}

/* Flex Utilities */
.d-flex {
    display: flex !important;
}
.justify-content-center {
    justify-content: center !important;
}
.justify-content-between {
    justify-content: space-between !important;
}
.justify-content-end {
    justify-content: flex-end !important;
}
.align-items-center {
    align-items: center !important;
}
.flex-wrap {
    flex-wrap: wrap !important;
}

/* Flash Overlay (Toast Container) */
#flash-overlay {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
    max-width: 350px;
}

.toast-message {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    color: #fff;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-left: 5px solid var(--primary-color);
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.toast-message.success {
    border-left-color: var(--success-color);
}

.toast-message.danger {
    border-left-color: var(--error-color);
}

.toast-message.warning {
    border-left-color: var(--warning-color);
}

.toast-message.info {
    border-left-color: var(--info-color);
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    margin-left: 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
}

.toast-close:hover {
    color: #fff;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* General Link Styling */
a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Dashboard Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.tool-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #f472b6, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Landing Page Styles */
.display-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #6366f1, #ec4899, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.lead-text {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.btn-lg {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    border-radius: 2rem;
    display: inline-block;
    width: auto;
    /* Override default 100% block */
}

.btn-glow {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.btn-glow:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.7);
    transform: translateY(-2px);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0;
    z-index: 1000;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu::before {
    content: "";
    display: block;
    position: absolute;
    top: -0.5rem;
    /* Matches margin-top */
    left: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
}

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

.dropdown::after {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 25px;
    z-index: 999;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding-left: 1.5rem;
    /* Slight shift effect */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Utilities */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

a.glass-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.text-gradient {
    background: linear-gradient(to right, #f472b6, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.fade-in-up {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

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

.badge-secondary {
    color: #fff;
    background-color: var(--text-muted);
}

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

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

.badge-info {
    color: #fff;
    background-color: var(--info-color);
}

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

* {
    box-sizing: border-box;
}

/* --- RESPONSIVE GRID SYSTEM --- */

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-3,
.col-md-4,
.col-md-6,
.col-md-8,
.col-md-9,
.col-md-12 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* Mobile First: Stacked by default */
.col-md-3,
.col-md-4,
.col-md-6,
.col-md-8,
.col-md-9,
.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Desktop: Media Query for min-width 768px */
@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

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

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

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

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

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

/* --- UTILITIES --- */
.d-flex {
    display: flex !important;
}

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

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

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

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

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

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

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

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

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

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

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

.mr-2 {
    margin-right: 0.5rem !important;
}

.ml-3 {
    margin-left: 1rem !important;
}

.p-3 {
    padding: 1rem !important;
}

.d-block {
    display: block !important;
}

.d-none {
    display: none !important;
}

/* Form Inline */
.form-inline {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}

/* Responsive Utilities */
@media (max-width: 767.98px) {
    .text-right {
        text-align: left !important;
    }

    /* Reset text alignment on mobile usually looks better */
    .navbar .container {
        padding: 0 1rem;
    }
}


/* --- RESPONSIVE NAVBAR --- */
.navbar-toggler {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
}

.navbar-toggler-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    position: relative;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    position: absolute;
    left: 0;
}

.navbar-toggler-icon::before {
    top: -8px;
}

.navbar-toggler-icon::after {
    bottom: -8px;
}

.navbar-menu {
    display: flex;
    width: 100%;
    align-items: center;
}

.navbar-menu .navbar-nav:not(.right) {
    flex: 1;
    justify-content: center;
}

@media (max-width: 991.98px) {
    .navbar .container {
        /* No wrapping needed for absolute positioning */
        position: static;
        /* Ensure absolute child relates to navbar, not container unless intended */
    }

    /* Make navbar positioned so menu is relative to it */
    .navbar {
        position: sticky;
        /* Already set, but ensures context */
    }

    .navbar-toggler {
        display: block;
        /* Show hamburger */
    }

    .navbar-menu {
        display: none;
        /* Hide menu by default */
        position: absolute;
        /* Overlay content */
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1001;
        /* Above content */

        flex-direction: column;
        width: 100%;
        margin-top: 0;
        background: rgba(15, 23, 42, 0.98);
        /* High opacity for readability */
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

    .navbar-menu.show {
        display: flex;
        /* Show when toggled */
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        margin-bottom: 1rem;
    }

    .navbar-nav.right {
        margin-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }
}

/* --- PAGINATION --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.8rem;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.page-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.page-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border: none;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.page-link.disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.page-link.disabled:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.page-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}