html, body {
    font-family: 'IBM Plex Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Modern Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(155, 155, 155, 0.4) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(155, 155, 155, 0.35);
    border-radius: 9999px;
    transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(155, 155, 155, 0.6);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Dark sidebar scrollbar */
.bg-sidebar-dark::-webkit-scrollbar-thumb,
aside::-webkit-scrollbar-thumb,
aside *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.bg-sidebar-dark::-webkit-scrollbar-thumb:hover,
aside::-webkit-scrollbar-thumb:hover,
aside *::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Material Symbols Icons Configuration */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Iconify Icon Styles */
.iconify {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

.iconify-inline {
    vertical-align: -0.125em;
}

/* Animated Icon Styles */
.icon-spin {
    animation: icon-spin 1s linear infinite;
}

.icon-pulse {
    animation: icon-pulse 1.5s ease-in-out infinite;
}

.icon-bounce {
    animation: icon-bounce 1s ease infinite;
}

@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes icon-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}


a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ============================================
   FULLSCREEN GENERATING OVERLAY - 3D CUBE
   ============================================ */

/* 3D Scene container */
.gen-scene {
    width: 100px;
    height: 100px;
    perspective: 600px;
}

/* Rotating 3D cube */
.gen-cube {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: gen-cube-spin 4s ease-in-out infinite;
}

.gen-cube-face {
    position: absolute;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.1));
    backdrop-filter: blur(4px);
    color: rgba(165, 180, 252, 0.9);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15), inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.gen-front  { transform: rotateY(0deg) translateZ(50px); }
.gen-back   { transform: rotateY(180deg) translateZ(50px); }
.gen-right  { transform: rotateY(90deg) translateZ(50px); }
.gen-left   { transform: rotateY(-90deg) translateZ(50px); }
.gen-top    { transform: rotateX(90deg) translateZ(50px); }
.gen-bottom { transform: rotateX(-90deg) translateZ(50px); }

@keyframes gen-cube-spin {
    0%   { transform: rotateX(0deg) rotateY(0deg); }
    25%  { transform: rotateX(90deg) rotateY(90deg); }
    50%  { transform: rotateX(180deg) rotateY(180deg); }
    75%  { transform: rotateX(270deg) rotateY(270deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* Orbiting particles */
.gen-orbit {
    position: absolute;
    width: 220px;
    height: 220px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: gen-orbit-rotate 6s linear infinite;
    pointer-events: none;
}

.gen-particle {
    position: absolute;
    border-radius: 50%;
    animation: gen-particle-pulse 2s ease-in-out infinite;
}

.gen-p1 {
    width: 8px; height: 8px;
    background: #818cf8;
    top: 0; left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 12px #818cf8, 0 0 24px rgba(129, 140, 248, 0.3);
    animation-delay: 0s;
}
.gen-p2 {
    width: 6px; height: 6px;
    background: #60a5fa;
    top: 25%; right: 4%;
    box-shadow: 0 0 12px #60a5fa, 0 0 24px rgba(96, 165, 250, 0.3);
    animation-delay: 0.3s;
}
.gen-p3 {
    width: 10px; height: 10px;
    background: #a78bfa;
    bottom: 20%; right: 0;
    box-shadow: 0 0 12px #a78bfa, 0 0 24px rgba(167, 139, 250, 0.3);
    animation-delay: 0.6s;
}
.gen-p4 {
    width: 5px; height: 5px;
    background: #34d399;
    bottom: 0; left: 40%;
    box-shadow: 0 0 12px #34d399, 0 0 24px rgba(52, 211, 153, 0.3);
    animation-delay: 0.9s;
}
.gen-p5 {
    width: 7px; height: 7px;
    background: #f472b6;
    bottom: 25%; left: 2%;
    box-shadow: 0 0 12px #f472b6, 0 0 24px rgba(244, 114, 182, 0.3);
    animation-delay: 1.2s;
}
.gen-p6 {
    width: 9px; height: 9px;
    background: #fbbf24;
    top: 18%; left: 5%;
    box-shadow: 0 0 12px #fbbf24, 0 0 24px rgba(251, 191, 36, 0.3);
    animation-delay: 1.5s;
}

@keyframes gen-orbit-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes gen-particle-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.6); }
}

/* Glowing text */
.gen-text-glow {
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5), 0 0 40px rgba(99, 102, 241, 0.2);
    animation: gen-glow 2s ease-in-out infinite alternate;
}

@keyframes gen-glow {
    from { text-shadow: 0 0 20px rgba(99, 102, 241, 0.3), 0 0 40px rgba(99, 102, 241, 0.1); }
    to   { text-shadow: 0 0 30px rgba(99, 102, 241, 0.6), 0 0 60px rgba(99, 102, 241, 0.3); }
}

/* Phase text fade pulse */
.gen-fade-pulse {
    animation: gen-fade 2.5s ease-in-out infinite;
}

@keyframes gen-fade {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

/* Progress bar gradient animation */
.gen-progress-bar {
    background: linear-gradient(90deg, #818cf8, #60a5fa, #a78bfa, #818cf8);
    background-size: 300% 100%;
    animation: gen-progress-shine 2s linear infinite;
}

@keyframes gen-progress-shine {
    0%   { background-position: 0% 0; }
    100% { background-position: 300% 0; }
}

/* ─── Info Tooltip ─── */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
}

.info-tip-icon {
    font-size: 16px !important;
    color: #9ca3af;
    transition: color 0.15s;
}

.info-tip:hover .info-tip-icon {
    color: #6366f1;
}

.info-tip-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
}

.info-tip-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    color: #fff;
    background: #1e293b;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 100;
    white-space: normal;
    animation: info-tip-in 0.15s ease-out;
}

/* When tooltip would overflow top, show below instead — handled via left-align fallback */
.info-tip-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

@keyframes info-tip-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Dark mode adjustment */
@media (prefers-color-scheme: dark) {
    .info-tip-popup {
        background: #334155;
    }
    .info-tip-popup::before {
        border-top-color: #334155;
    }
}

/* ============================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================ */

/* Bottom nav container */
.btm-nav {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Active nav item indicator dot */
.btm-nav-active {
    position: relative;
}
.btm-nav-active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #5a60ff;
}

/* Create button on bottom nav — no dot indicator */
.btm-nav-create.btm-nav-active::after {
    display: none;
}

/* Bottom sheet slide-up animation */
.btm-sheet-enter {
    animation: btm-sheet-slide-up 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes btm-sheet-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   MOBILE-FIRST COMPACT STYLES
   ============================================ */

@media (max-width: 1023px) {
    /* Tighter page content padding */
    .content {
        padding-top: 0.5rem;
    }

    /* Compact page titles & subtitles */
    h1 {
        font-size: 1.25rem !important;
        line-height: 1.75rem;
    }

    /* Compact stat cards on dashboard */
    .bg-surface-light.rounded-xl,
    .bg-surface-dark.rounded-xl {
        padding: 0.75rem !important;
    }

    .bg-surface-light.rounded-xl .text-3xl,
    .bg-surface-dark.rounded-xl .text-3xl {
        font-size: 1.5rem !important;
    }

    .bg-surface-light.rounded-xl .h-12.w-12,
    .bg-surface-dark.rounded-xl .h-12.w-12 {
        height: 2.25rem !important;
        width: 2.25rem !important;
    }

    .bg-surface-light.rounded-xl .h-12.w-12 .text-2xl,
    .bg-surface-dark.rounded-xl .h-12.w-12 .text-2xl {
        font-size: 1.125rem !important;
    }

    /* Compact card padding for dashboard stat cards only */

    /* Reduce section headers on dashboard */

    /* Tighter spacing for content creation form */
    .space-y-5 > * + * {
        margin-top: 0.875rem !important;
    }
    .space-y-6 > * + * {
        margin-top: 1rem !important;
    }
    .space-y-8 > * + * {
        margin-top: 1.25rem !important;
    }

    /* Compact form inputs */
    select, input[type="text"], input[type="email"], input[type="password"], textarea {
        font-size: 0.875rem !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    textarea {
        min-height: 80px !important;
    }

    /* Compact buttons */
    .bg-primary, button[class*="bg-primary"] {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        font-size: 0.8125rem !important;
    }

    /* Compact breadcrumbs */
    header.sticky {
        padding: 0.75rem 1rem !important;
    }
    header.sticky .mb-3 {
        margin-bottom: 0.25rem !important;
    }
    header.sticky h1 {
        font-size: 1.375rem !important;
    }

    /* Compact grid gaps */
    .grid.gap-4 {
        gap: 0.625rem !important;
    }
    .grid.gap-6 {
        gap: 0.75rem !important;
    }
    .grid.gap-8 {
        gap: 1rem !important;
    }

    /* Compact page wrapper padding on mobile — preserve bottom padding */
    .p-6, .p-8 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 0.75rem !important;
    }
    .px-8 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .py-5 {
        padding-top: 0.625rem !important;
        padding-bottom: 0.625rem !important;
    }

    /* Compact margin bottom for sections */
    .mb-6 {
        margin-bottom: 1rem !important;
    }
    .mb-8 {
        margin-bottom: 1.25rem !important;
    }

    /* Make images and previews compact */
    .max-w-7xl {
        padding-left: 0;
        padding-right: 0;
    }

    /* Compact modal / overlay adjustments */
    .fixed.inset-0 .rounded-xl,
    .fixed.inset-0 .rounded-2xl {
        margin: 0.5rem;
    }
}