/* Shared modern UI theme */
:root {
    --app-bg: #f3f6fb;
    --app-bg-accent: radial-gradient(circle at top left, rgba(13, 110, 253, 0.14), transparent 34%), radial-gradient(circle at top right, rgba(25, 135, 84, 0.12), transparent 28%), linear-gradient(180deg, #f8fbff 0%, #f3f6fb 48%, #eef2f8 100%);
    --app-surface: rgba(255, 255, 255, 0.88);
    --app-surface-strong: #ffffff;
    --app-border: rgba(15, 23, 42, 0.08);
    --app-border-strong: rgba(15, 23, 42, 0.12);
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-primary: #2563eb;
    --app-primary-soft: rgba(37, 99, 235, 0.12);
    --app-success-soft: rgba(25, 135, 84, 0.12);
    --app-warning-soft: rgba(255, 193, 7, 0.18);
    --app-danger-soft: rgba(220, 53, 69, 0.14);
    --app-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --app-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
    --app-radius: 1rem;
    --app-radius-sm: 0.85rem;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    color: var(--app-text);
    background: var(--app-bg-accent);
    background-attachment: fixed;
}

body.bg-light {
    background: var(--app-bg-accent) !important;
}

a {
    text-underline-offset: 0.18em;
}

.container,
.container-fluid {
    position: relative;
}

.card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--app-shadow-soft);
    overflow: hidden;
}

.card.shadow,
.card.shadow-sm,
.shadow,
.shadow-sm {
    box-shadow: var(--app-shadow) !important;
}

.card-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.92) 100%);
    border-bottom: 1px solid var(--app-border);
    font-weight: 600;
}

.table {
    --bs-table-bg: transparent;
}

.table > :not(caption) > * > * {
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

.table-light,
.table thead {
    --bs-table-bg: rgba(248, 250, 252, 0.92);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(148, 163, 184, 0.06);
}

.navbar.navbar-dark.bg-dark {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.9)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar-brand {
    letter-spacing: 0.01em;
}

.navbar .nav-link {
    border-radius: 999px;
    padding-inline: 0.9rem;
    transition: all 0.18s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
}

.app-nav-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
    padding: 0.3rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.btn {
    border-radius: 0.85rem;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.btn-sm {
    border-radius: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border-color: #15803d;
}

.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-light {
    backdrop-filter: blur(8px);
}

.form-control,
.form-select,
.input-group-text,
textarea {
    border-radius: 0.85rem !important;
    border-color: rgba(148, 163, 184, 0.32);
    min-height: 2.75rem;
    box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.14);
}

.badge {
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
}

.alert {
    border: 1px solid transparent;
    border-radius: 1rem;
    box-shadow: var(--app-shadow-soft);
}

.alert-warning {
    background: #fff8db;
    border-color: rgba(255, 193, 7, 0.28);
}

.alert-danger {
    background: #fff1f2;
    border-color: rgba(220, 53, 69, 0.2);
}

.alert-success {
    background: #ecfdf3;
    border-color: rgba(25, 135, 84, 0.2);
}

.pagination .page-link {
    border-radius: 0.75rem;
    margin-inline: 0.15rem;
    border-color: rgba(148, 163, 184, 0.26);
    color: var(--app-text);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.pagination .active > .page-link {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
}

.list-group-item {
    border-color: rgba(148, 163, 184, 0.18);
}

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: 1.1rem;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.modal-header,
.modal-footer {
    border-color: rgba(148, 163, 184, 0.18);
}

#global-loader {
    position: fixed;
    inset: 0;
    /* place the global loader under Bootstrap modal/backdrop so modals remain interactive
       Bootstrap modal backdrop z-index ~1050, modal ~1055 */
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#global-loader.visible {
    opacity: 1;
    visibility: visible;
    /* allow pointer events to pass through the dim backdrop so other UI (modals)
       can remain interactive; keep the loader card itself interactive */
    pointer-events: none;
}

/* make the loader card accept pointer events (so buttons inside it work) */
.global-loader-card {
    pointer-events: auto;
}

.global-loader-card {
    min-width: min(90vw, 320px);
    padding: 1.25rem 1.35rem;
    border-radius: 1.1rem;
    background: rgba(255,255,255,0.92);
    color: var(--app-text);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.global-loader-spinner {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    border: 3px solid rgba(37, 99, 235, 0.18);
    border-top-color: var(--app-primary);
    animation: global-loader-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.global-loader-title {
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.global-loader-text {
    font-size: 0.92rem;
    color: var(--app-muted);
}

.loading-button {
    position: relative;
}

.loading-button.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.loading-button.is-loading .loading-button-spinner {
    display: inline-block;
}

.loading-button-spinner {
    display: none;
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: global-loader-spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: -0.125rem;
}

.auth-shell,
body.d-flex.align-items-center.justify-content-center.vh-100 {
    position: relative;
}

body.d-flex.align-items-center.justify-content-center.vh-100::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(37,99,235,0.18), transparent 38%), radial-gradient(circle at bottom right, rgba(22,163,74,0.16), transparent 30%);
    pointer-events: none;
}

body.d-flex.align-items-center.justify-content-center.vh-100 .card {
    width: min(100%, 460px);
    border: 1px solid rgba(255,255,255,0.4);
}

.work-btn,
.menu-card,
.apk-card {
    border-radius: 1rem !important;
    box-shadow: var(--app-shadow-soft) !important;
}

.menu-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255,255,255,0.82) !important;
}

.apk-card {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
}

.status-badge.planned {
    background: #fde68a;
    color: #854d0e;
}

.status-badge.in_progress {
    background: #2563eb;
    color: #fff;
}

.status-badge.completed {
    background: #16a34a;
    color: #fff;
}

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

@media (max-width: 767.98px) {
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card {
        border-radius: 0.9rem;
    }

    .global-loader-card {
        min-width: 0;
        width: 100%;
    }
}
