/* Radiochromic Film Platform - Main Stylesheet */

:root {
    /* === PRIMARY COLORS - Professional Navy Blues === */
    --primary-navy-900: #0F2B47;
    --primary-navy-800: #153A57;
    --primary-navy-700: #1F4866;
    --primary-navy-600: #2D5A7A;
    --primary-navy-500: #3D6B8C;

    /* === NEUTRALS - Sophisticated Grays with Blue Undertone === */
    --neutral-white: #FFFFFF;
    --neutral-black: #0A0E14;
    --neutral-50: #FAFBFC;
    --neutral-100: #F5F7F9;
    --neutral-200: #E8ECF1;
    --neutral-300: #D4DBE3;
    --neutral-400: #A8B4C3;
    --neutral-500: #7B8A9D;
    --neutral-600: #5A6B7D;
    --neutral-700: #3D4D5E;
    --neutral-800: #1F2933;

    /* === ACCENT GOLDEN - Premium & Professional === */
    --accent-gold-900: #5A4700;
    --accent-gold-700: #A8860F;
    --accent-gold-500: #D4AF37;
    --accent-gold-300: #E8DCC4;
    --accent-gold-100: #F7F2E8;

    /* === SUCCESS GREEN - Professional Medical === */
    --success-900: #0B3D2C;
    --success-700: #158756;
    --success-500: #2FA070;
    --success-300: #A8D5B8;
    --success-100: #E0F2E9;

    /* === DANGER RED - Medical Alert === */
    --danger-900: #5C1818;
    --danger-700: #A63838;
    --danger-500: #D4505C;
    --danger-300: #E5A9A9;
    --danger-100: #F5DFDF;

    /* === WARNING AMBER - Professional Caution === */
    --warning-900: #6B4E0F;
    --warning-700: #B8860F;
    --warning-500: #D4A030;
    --warning-300: #EDD4A4;
    --warning-100: #F9F3E6;

    /* === INFO BLUE - Secondary Communication === */
    --info-900: #1F3D5C;
    --info-700: #3366A0;
    --info-500: #4A7FBF;
    --info-300: #B3D4E8;
    --info-100: #E6F1F7;

    /* === TEXT COLORS === */
    --text-primary: #1F2933;
    --text-secondary: #5A6B7D;
    --text-tertiary: #7B8A9D;
    --text-disabled: #A8B4C3;
    --text-on-dark: #FFFFFF;
    --text-on-dark-secondary: rgba(255, 255, 255, 0.75);
    --text-on-gold: #5A4700;
    --text-on-success: #0B3D2C;
    --text-on-danger: #5C1818;
    --text-on-warning: #6B4E0F;
    --link-primary: #1F4866;
    --link-hover: #153A57;

    /* === BACKGROUND COLORS === */
    --bg-body: #FAFBFC;
    --bg-surface-secondary: #F5F7F9;
    --bg-hover: #F5F7F9;

    /* === BORDER COLORS === */
    --border-color: #E8ECF1;

    /* === SHADOWS - Minimal Apple-Style === */
    --shadow-sm: 0 1px 2px rgba(10, 22, 40, 0.05);
    --shadow-md: 0 2px 6px rgba(10, 22, 40, 0.08);
    --shadow-lg: 0 4px 12px rgba(10, 22, 40, 0.12);
    --shadow-xl: 0 8px 24px rgba(10, 22, 40, 0.15);

    /* === FOCUS STATE === */
    --focus-ring-color: rgba(26, 58, 92, 0.1);

    /* === LAYOUT === */
    --sidebar-width: 260px;

    /* === LEGACY COMPATIBILITY === */
    --primary-blue: var(--primary-navy-700);
    --primary-blue-dark: var(--primary-navy-800);
    --primary-blue-light: var(--primary-navy-600);
    --primary-teal: var(--primary-navy-700);
    --primary-dark: var(--primary-navy-800);
    --primary-light: var(--primary-navy-600);
    --accent-blue: var(--primary-navy-700);
    --secondary-teal: var(--info-700);
    --secondary-teal-dark: var(--info-900);
    --secondary-teal-light: var(--info-500);
    --accent-mint: var(--success-500);
    --accent-golden: var(--accent-gold-500);
    --accent-golden-dark: var(--accent-gold-700);
    --accent-golden-light: var(--accent-gold-300);
    --accent-coral: var(--accent-gold-500);
    --accent-coral-dark: var(--accent-gold-700);
    --accent-coral-light: var(--accent-gold-300);
    --color-success: var(--success-700);
    --color-warning: var(--warning-500);
    --color-danger: var(--danger-700);
    --color-info: var(--info-700);
}

/* Brand Colors */
.navbar {
    background: linear-gradient(135deg, var(--primary-navy-700) 0%, var(--primary-navy-800) 100%) !important;
    box-shadow: var(--shadow-sm);
    border-bottom: none;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--text-on-dark) !important;
}

.navbar-text {
    color: var(--text-on-dark) !important;
}

.nav-link {
    color: var(--text-on-dark-secondary) !important;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-on-dark) !important;
}

/* === MOBILE HEADER === */

.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-navy-700) 0%, var(--primary-navy-800) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.mobile-header-btn {
    background: none;
    border: none;
    color: var(--text-on-dark);
    font-size: 1.5rem;
    padding: 0.25rem;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.mobile-header-logo img {
    height: 32px;
    width: auto;
}

/* === SIDEBAR OVERLAY === */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* === SIDEBAR === */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-navy-700) 0%, var(--primary-navy-900) 100%);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-logo:hover {
    text-decoration: none;
}

.sidebar-logo img {
    height: 44px;
    width: auto;
}

.logo-beta-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.beta-badge {
    position: absolute;
    bottom: -4px;
    right: -6px;
    background: var(--accent-gold-500);
    color: var(--text-on-gold);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.4;
    pointer-events: none;
}

.sidebar-close {
    position: absolute;
    right: 1.25rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

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

/* Sidebar Status (License & Storage) */
.sidebar-status {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 auto;
}

.sidebar-license {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.sidebar-license-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.58);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
}

.sidebar-license .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.7em;
    white-space: nowrap;
}

.sidebar-storage {
    display: block;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s;
}

.sidebar-storage:hover {
    color: #fff;
    text-decoration: none;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.storage-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem 0;
    min-height: 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 1px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 1.25rem;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-align: left;
}

.sidebar-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.sidebar-link.is-active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-link i:first-child {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar-submenu-toggle.is-open .sidebar-chevron {
    transform: rotate(180deg);
}

/* Sidebar Submenu */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-submenu.is-open {
    max-height: 500px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1.25rem 0.45rem 3rem;
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sidebar-sublink:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.sidebar-sublink.is-active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 500;
}

.sidebar-sublink i {
    font-size: 0.85rem;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-submenu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.25rem 1.25rem 0.25rem 3rem;
}

/* Sidebar Footer (User Section) */
.sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.sidebar-user-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-toggle .sidebar-chevron {
    transition: transform 0.2s ease;
}

.sidebar-user-toggle.is-open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-user-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-user-menu.is-open {
    max-height: 400px;
}

.sidebar-user-menu li a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1.25rem 0.4rem 3rem;
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.sidebar-user-menu li a:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.sidebar-user-menu li a i {
    font-size: 0.85rem;
    width: 1rem;
    text-align: center;
}

.sidebar-user-menu .sidebar-submenu-divider {
    margin-left: 3rem;
    margin-right: 1.25rem;
}

a.sidebar-logout {
    color: rgba(255, 100, 100, 0.8) !important;
}

a.sidebar-logout:hover {
    color: #ff6b6b !important;
    background: rgba(255, 100, 100, 0.1) !important;
}

/* === APP CONTENT LAYOUT === */

.app-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.app-content > footer {
    margin-top: auto;
}

.has-sidebar .app-content {
    margin-left: var(--sidebar-width);
}

body.sidebar-open {
    overflow: hidden;
}

/* === SIDEBAR RESPONSIVE === */

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .has-sidebar .app-content {
        margin-left: 0;
        padding-top: 56px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-navy-700) 0%, var(--primary-navy-800) 100%);
    border: none;
    color: var(--text-on-dark);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-navy-800);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--primary-navy-600);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.2);
}

.btn-primary:active,
.btn-primary.active {
    background: var(--primary-navy-900);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
}

.btn-secondary {
    background: var(--neutral-white);
    border: 1px solid var(--neutral-300);
    color: var(--primary-navy-700);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--neutral-100);
    border-color: var(--primary-navy-600);
    box-shadow: var(--shadow-md);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--primary-navy-600);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(var(--primary-navy-700-rgb, 26, 54, 93), 0.15);
}

.btn-secondary:active,
.btn-secondary.active {
    background: var(--neutral-200);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.btn-premium {
    background: linear-gradient(135deg, var(--accent-gold-700) 0%, var(--accent-gold-500) 100%);
    border: none;
    color: var(--neutral-white);
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-premium:hover {
    background: var(--accent-gold-700);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4);
}

.badge-primary {
    background-color: var(--primary-navy-700);
}

/* Utility Classes */
.bg-gradient-teal {
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-light) 100%);
}

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

/* Image Loading Shimmer */
.image-skeleton {
    position: relative;
    background: var(--neutral-100);
    overflow: hidden;
}

.image-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
    animation: shimmer 1.2s infinite;
    pointer-events: none;
}

.image-skeleton img {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-skeleton.is-loaded img {
    opacity: 1;
}

.image-skeleton.is-loaded::after {
    opacity: 0;
    animation: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .image-skeleton::after {
        animation: none;
    }
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--neutral-white);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

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

.card-header {
    background: var(--neutral-50);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
}

/* Forms */
.form-control,
.form-select {
    border: 1px solid var(--neutral-300);
    background-color: var(--neutral-white);
    color: var(--text-primary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-navy-700);
    box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1);
    outline: none;
}

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

.form-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-teal);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1100;
    opacity: 0;
}

.skip-link:focus {
    top: 0;
    opacity: 1;
}

/* Tables */
.table {
    margin-bottom: 0;
    background-color: var(--neutral-white);
    border: 1px solid var(--border-color);
}

.table thead th {
    background: var(--neutral-50);
    border-bottom: 2px solid var(--neutral-300);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

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

/* Alerts */
.alert-success {
    background-color: var(--success-100);
    border: 1px solid var(--success-300);

    color: var(--text-on-success);
}

.alert-danger {
    background-color: var(--danger-100);
    border: 1px solid var(--danger-300);

    color: var(--text-on-danger);
}

.alert-warning {
    background-color: var(--warning-100);
    border: 1px solid var(--warning-300);

    color: var(--text-on-warning);
}

.alert-info {
    background-color: var(--info-100);
    border: 1px solid var(--info-300);

    color: var(--info-900);
}

.alert-premium {
    background-color: var(--accent-gold-100);
    border: 1px solid var(--accent-gold-300);

    color: var(--text-on-gold);
}

/* Loading States */
.spinner-border {
    color: var(--primary-navy-700);
}

.spinner-grow {
    background-color: var(--primary-navy-700);
}

/* Buttons with Icons */
.btn i {
    margin-right: 0.5rem;
}

/* Link Styling */
a {
    color: var(--link-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Pagination */
.pagination .page-link {
    color: var(--link-primary);
    border-color: var(--border-color);
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background-color: var(--neutral-100);
    border-color: var(--primary-navy-600);
    color: var(--link-hover);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-navy-700);
    border-color: var(--primary-navy-700);
    color: white;
}

/* Body & Background */
body {
    background: linear-gradient(180deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.text-white h1, .text-white h2, .text-white h3,
.text-white h4, .text-white h5, .text-white h6 {
    color: #fff;
}

/* Hero Section */
.hero {
    padding: 2rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero h1 .hero-wave {
    color: #4a5568;
    font-weight: 300;
}

.hero h1 .hero-chrome {
    color: #4a5568;
    font-weight: 300;
}

.hero h1 .hero-film {
    color: #7D9E4F;
    font-weight: 700;
}

.hero h1 .hero-portal {
    color: #D4C34F;
    font-weight: 700;
}

.hero .lead {
    font-size: 1.125rem;
    color: #6b7280;
    font-weight: 500;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero .lead {
        font-size: 1rem;
    }
}

/* Footer */
footer {
    background: var(--neutral-100);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    color: var(--text-secondary);
}

/* Main Content */
main {
    min-height: 80vh;
    background: transparent;
}

/* Utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    main {
        min-height: 70vh;
    }
}

/* === BOOTSTRAP OVERRIDES === */

/* Button Semantic Colors */
.btn-success {
    background: linear-gradient(135deg, var(--success-700) 0%, var(--success-500) 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover,
.btn-success:focus {
    background: var(--success-700);
    box-shadow: var(--shadow-md);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-700) 0%, var(--info-500) 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-info:hover,
.btn-info:focus {
    background: var(--info-700);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-700) 0%, var(--warning-500) 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover,
.btn-warning:focus {
    background: var(--warning-700);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-700) 0%, var(--danger-500) 100%);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover,
.btn-danger:focus {
    background: var(--danger-700);
    box-shadow: var(--shadow-md);
}

.btn-danger:focus-visible {
    outline: 2px solid var(--danger-700);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2);
}

.btn-success:focus-visible {
    outline: 2px solid var(--success-700);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.2);
}

.btn-warning:focus-visible {
    outline: 2px solid var(--warning-700);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.2);
}

.btn-info:focus-visible {
    outline: 2px solid var(--info-700);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
}

.btn-premium:focus-visible {
    outline: 2px solid var(--accent-gold-700);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}

/* Outline button focus states */
.btn-outline-primary:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-outline-danger:focus-visible,
.btn-outline-success:focus-visible,
.btn-outline-warning:focus-visible,
.btn-outline-info:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* Badge Semantic Colors */
.badge.bg-primary {
    background-color: var(--primary-navy-700) !important;
    color: white;
}

.badge.bg-success {
    background-color: var(--success-700) !important;
    color: white;
}

.badge.bg-info {
    background-color: var(--info-700) !important;
    color: white;
}

.badge.bg-warning {
    background-color: var(--warning-700) !important;
    color: white;
}

.badge.bg-danger {
    background-color: var(--danger-700) !important;
    color: white;
}

.badge.bg-premium {
    background: linear-gradient(135deg, var(--accent-gold-700) 0%, var(--accent-gold-500) 100%) !important;
    color: white;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(184, 134, 11, 0.3);
}

/* Background Color Utilities */
.bg-primary {
    background-color: var(--primary-navy-700) !important;
}

.bg-success {
    background-color: var(--success-700) !important;
}

.bg-info {
    background-color: var(--info-700) !important;
}

.bg-warning {
    background-color: var(--warning-700) !important;
}

.bg-danger {
    background-color: var(--danger-700) !important;
}

.text-primary {
    color: var(--primary-navy-700) !important;
}

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

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

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

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

/* ── Disabled State ─────────────────────────────────────────────────────── */
.btn:disabled,
.btn[disabled],
.btn.disabled,
a.btn.disabled,
fieldset:disabled .btn {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: auto; /* keep cursor:not-allowed visible */
    box-shadow: none;
    transform: none;
}

/* ── Required Field Indicator ───────────────────────────────────────────── */
.form-label .required-indicator {
    color: var(--danger-700);
    margin-left: 2px;
    font-weight: 600;
    aria-hidden: true;
}

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    line-height: 1;
    display: block;
    color: var(--neutral-400);
}

.empty-state-title {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-text {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

/* ── Flash Message Dismiss Transition ───────────────────────────────────── */
.alert {
    transition: opacity 0.3s ease, margin-bottom 0.3s ease, padding 0.3s ease, max-height 0.3s ease;
}

.alert.collapsing-out {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    overflow: hidden;
}

/* ── NS-Inspired Table Enhancements ─────────────────────────────────────── */

/* Sticky, scannable column headers (NS persistent context pattern) */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--neutral-100);
    border-bottom: 2px solid var(--neutral-200) !important;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

/* Clickable rows (NS whole-row tap navigation) */
tr[data-href] {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

tr[data-href]:hover {
    background-color: var(--neutral-100) !important;
}

/* Action button cluster: subtle at rest, fully visible on row hover */
tr .row-actions {
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

tr:hover .row-actions,
tr:focus-within .row-actions {
    opacity: 1;
}

/* ── NS-Style Pill Search Inputs ─────────────────────────────────────────── */

/* Rounded pill style for filter card search inputs */
.filter-card .form-control,
.filter-card .form-select {
    border-radius: 20px;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ── Relative Timestamp ──────────────────────────────────────────────────── */

/* Date cells with relative timestamps show a tooltip on hover */
[data-ts] {
    cursor: default;
    border-bottom: 1px dotted var(--neutral-400);
    text-underline-offset: 2px;
}

/* ── Form Submit Loading State ──────────────────────────────────────────── */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1em;
    height: 1em;
    margin-top: -0.5em;
    margin-left: -0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.65s linear infinite;
    color: white;
}
