/* TECH LIGHT THEME VARIABLES */
:root {
    /* Backgrounds */
    --tech-bg-dark: #f8fafc;
    /* Very light blue-gray instead of dark */
    --tech-bg-card: rgba(255, 255, 255, 0.8);
    /* Light glass */

    /* Colors */
    --tech-primary: #2563eb;
    /* Strong blue */
    --tech-accent: #0891b2;
    /* Cyan darken */
    --tech-success: #059669;
    --tech-warning: #d97706;
    --tech-danger: #dc2626;

    /* Text */
    --tech-text-main: #334155;
    /* Slate 700 */
    --tech-text-muted: #64748b;
    /* Slate 500 */

    /* Borders & Effects */
    --tech-border: rgba(148, 163, 184, 0.3);
    --tech-glass: blur(12px);
    --tech-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --tech-glow: 0 0 15px rgba(37, 99, 235, 0.15);
    /* Subtle blue glow */
}

/* Homepage Hero Decoration */
.hero-pattern {
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.feature-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-card:hover .feature-icon-box {
    transform: scale(1.1) rotate(5deg);
}

body {
    background-color: var(--tech-bg-dark);
    color: var(--tech-text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Light tech background */
    background-image:
        radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.05), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(8, 145, 178, 0.05), transparent 40%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    /* Override default template margin */
}

/* Ensure html has full height for flex to work */
html {
    height: 100%;
}

/* Fix main container to push footer down */
.container-lg {
    flex: 1 0 auto;
}

/* Glassmorphism Cards */
.card,
.navbar,
.modal-content,
.dropdown-menu {
    background: var(--tech-bg-card);
    backdrop-filter: var(--tech-glass);
    border: 1px solid white;
    box-shadow: var(--tech-shadow);
    color: var(--tech-text-main);
}

.dropdown-menu {
    z-index: 1050;
}

.card {
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
    border-bottom: 1px solid var(--tech-border);
    font-weight: 600;
}

.card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    transform: translateY(-2px);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #1e293b;
    /* Slate 800 */
    font-weight: 700;
    letter-spacing: -0.015em;
}

.text-muted {
    color: var(--tech-text-muted) !important;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--tech-border);
    position: relative;
    z-index: 1020;
}

.navbar-brand {
    font-weight: 800;
    color: var(--tech-primary) !important;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.site-brand-logo {
    height: 34px;
    width: auto;
}

.nav-link {
    color: var(--tech-text-muted) !important;
    transition: color 0.15s;
    font-weight: 500;
}

.navbar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.9375rem;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--tech-primary) !important;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 6px;
}

.navbar .nav-link.active {
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

.navbar-user-name {
    display: inline-block;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.navbar .dropdown-item {
    font-size: 0.9375rem;
}

/* 管理员登录后导航约需 1030px，低于 xl 时折叠 */
@media (max-width: 1199.98px) {
    .navbar-collapse .navbar-nav {
        padding-top: 0.5rem;
    }

    .navbar-collapse .navbar-user {
        margin-top: 0.5rem;
        border-top: 1px solid var(--tech-border);
    }
}

@media (max-width: 575.98px) {
    .site-brand {
        margin-right: 0;
        font-size: 1rem;
    }

    .site-brand-logo {
        height: 30px;
    }
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--tech-primary), var(--tech-accent));
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    font-weight: 600;
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-secondary,
.btn-light,
.btn-outline-secondary {
    background: white;
    border: 1px solid var(--tech-border);
    color: var(--tech-text-muted);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: #f1f5f9;
    color: var(--tech-text-main);
    border-color: var(--tech-text-muted);
}

/* Forms */
.form-control,
.form-select {
    background-color: white;
    border: 1px solid #cbd5e1;
    /* Slate 300 */
    color: var(--tech-text-main);
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background-color: white;
    border-color: var(--tech-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    color: var(--tech-text-main);
}

/* Placeholder color needs to be explicitly set for visibility */
.form-control::placeholder {
    color: #94a3b8;
}

.form-label {
    color: #475569;
    /* Slate 600 */
    font-weight: 600;
}

.input-group-text {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: var(--tech-text-muted);
}

/* Tables */
.table {
    color: var(--tech-text-main);
}

.table thead th {
    border-bottom: 2px solid var(--tech-border);
    color: #475569;
    background-color: #f8fafc;
}

.table td {
    border-bottom: 1px solid #e2e8f0;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* Footer */
footer,
.footer {
    position: relative !important;
    /* Force relative to flow with flexbox */
    bottom: auto !important;
    background: white !important;
    border-top: 1px solid var(--tech-border) !important;
    color: var(--tech-text-muted) !important;
    width: 100%;
    margin-top: auto;
    padding: 1rem 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    text-align: center;
}

.footer-sep {
    color: var(--tech-border);
}

.footer .footer-link {
    color: inherit;
    text-decoration: none;
}

.footer .footer-link:hover,
.footer .footer-link:focus-visible {
    color: var(--tech-primary);
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .footer-inner {
        flex-direction: column;
        gap: 0.125rem;
    }

    .footer-sep {
        display: none;
    }
}

/* Alerts */
.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-success {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

/* Helpers */
.text-gradient {
    background: linear-gradient(to right, var(--tech-primary), var(--tech-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.shadow-glow {
    box-shadow: var(--tech-glow);
}

/* Form floating labels override */
.form-floating>label {
    color: #64748b;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
    color: var(--tech-primary);
    background-color: transparent;
    /* No overlap issues */
}

/* Approval page shared helpers */
.approval-toolbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.approval-toolbar-form {
    margin: 0;
}

.approval-desktop-table .custom-table {
    table-layout: fixed;
}

.approval-col-applicant {
    width: 14%;
}

.approval-col-department {
    width: 17%;
}

.approval-col-unit {
    width: 22%;
}

.approval-col-type {
    width: 8%;
}

.approval-col-status {
    width: 12%;
}

.approval-col-date {
    width: 11%;
}

.approval-col-actions {
    width: 16%;
}

.approval-row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

.approval-action-btn {
    min-width: 4.9rem;
    white-space: nowrap;
    font-size: 0.8rem;
    line-height: 1.2;
}

.approval-text-wrap,
.approval-table-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.approval-table-text {
    display: -webkit-box;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.approval-table-text-department {
    -webkit-line-clamp: 2;
}

.approval-table-text-unit {
    -webkit-line-clamp: 3;
}

.approval-mobile-list {
    display: none;
}

.approval-mobile-card {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 28px -18px rgba(37, 99, 235, 0.35);
    padding: 1rem;
}

.approval-mobile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.approval-mobile-person {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.approval-mobile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.12);
    color: var(--tech-primary);
    font-weight: 700;
    flex-shrink: 0;
}

.approval-mobile-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
}

.approval-mobile-subtitle {
    color: var(--tech-text-muted);
    font-size: 0.875rem;
    line-height: 1.35;
    max-width: 100%;
}

.approval-mobile-card-grid {
    display: grid;
    gap: 0.75rem;
}

.approval-mobile-card-item {
    min-width: 0;
}

.approval-mobile-label {
    color: var(--tech-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0;
    margin-bottom: 0.2rem;
}

.approval-mobile-value {
    color: #1e293b;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.approval-mobile-value-muted {
    color: var(--tech-text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.approval-mobile-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.approval-mobile-actions .btn {
    width: 100%;
}

.approval-summary-strip {
    display: none;
}

.approval-summary-card {
    border-radius: 18px;
    padding: 1rem;
}

.approval-summary-grid {
    display: grid;
    gap: 0.75rem;
}

.approval-summary-pill {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    padding: 0.85rem 1rem;
}

.approval-summary-label {
    color: var(--tech-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0;
    margin-bottom: 0.2rem;
}

.approval-summary-value {
    color: #1e293b;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

.approval-section-anchor {
    scroll-margin-top: 5rem;
}

.approval-detail-header-actions,
.approval-detail-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.approval-sticky-actions {
    display: none;
}

.approval-role-button {
    width: 100%;
    justify-content: center;
}

.min-w-0 {
    min-width: 0;
}

@media (max-width: 767.98px) {
    .approval-toolbar > [class*='col-'] {
        width: 100%;
    }

    .approval-toolbar-actions {
        justify-content: stretch;
    }

    .approval-toolbar-actions .btn {
        width: 100%;
    }

    .approval-toolbar-form {
        width: 100%;
    }

    .approval-desktop-table {
        display: none !important;
    }

    .approval-mobile-list {
        display: grid;
        gap: 1rem;
        padding: 1rem;
    }

    .approval-summary-strip {
        display: block;
    }

    .approval-detail-header-actions,
    .approval-detail-footer-actions {
        width: 100%;
        display: grid;
        gap: 0.75rem;
    }

    .approval-detail-header-actions .btn,
    .approval-detail-footer-actions .btn {
        width: 100%;
        margin: 0 !important;
    }

    .approval-detail-footer-layout {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .approval-sticky-actions {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1045;
        padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
        background: rgba(248, 250, 252, 0.96);
        backdrop-filter: blur(14px);
        border-top: 1px solid rgba(148, 163, 184, 0.25);
        box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.12);
    }

    .approval-sticky-actions .approval-mobile-actions {
        margin-top: 0;
    }

    .approval-has-mobile-actions {
        padding-bottom: 7.5rem;
    }

    .approval-role-actions {
        gap: 0.75rem;
    }

    .approval-role-actions > [class*='col-'] {
        flex: 0 0 calc(50% - 0.375rem);
        max-width: calc(50% - 0.375rem);
        width: calc(50% - 0.375rem);
    }
}
