html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.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;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

.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;
}

/* ========================================================
   SEIEM 2026 - MODERN UI DESIGN SYSTEM
   Theme: Light with Guinda Institutional Accent
   ======================================================== */

:root {
    --color-guinda: #9F2241;
    --color-guinda-light: #F4E8EA;
    --color-guinda-hover: #7b1a32;
    --color-surface: #F8F9FE;
    --color-glass: rgba(255, 255, 255, 0.95);
    --border-glass: rgba(255, 255, 255, 0.4);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 32px rgba(159, 34, 65, 0.12);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 280px;
    --sidebar-width-collapsed: 80px;
}

body.bg-surface {
    background-color: var(--color-surface);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    overflow-x: hidden;
}

/* --- Layout Architecture --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--color-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1040;
    transition: var(--transition-smooth);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--color-guinda);
    color: white;
    box-shadow: 0 4px 12px rgba(159, 34, 65, 0.2);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Navigation Links */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-left: 0.75rem;
    margin-bottom: 0.75rem;
    display: block;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
    margin-bottom: 4px;
}

.nav-item-link i {
    font-size: 1.2rem;
    transition: var(--transition-smooth);
}

.nav-item-link:hover {
    background-color: var(--color-guinda-light);
    color: var(--color-guinda);
    transform: translateX(4px);
}

.nav-item-link.active {
    background-color: var(--color-guinda);
    color: white;
    box-shadow: var(--shadow-hover);
}

.text-danger-hover:hover {
    background-color: #fee2e2 !important;
    color: #ef4444 !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-guinda-light);
    color: var(--color-guinda);
    font-size: 1.2rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* --- Main Workspace --- */
.app-main-workspace {
    flex: 1;
    width: calc(100vw - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

.workspace-header {
    background: var(--color-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    z-index: 1020;
}

.page-title {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show-mobile {
        transform: translateX(0);
    }

    .app-main-workspace {
        margin-left: 0;
        width: 100vw;
    }
}

/* --- Premium Tables CRUD --- */
.table-premium {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.table-premium thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table-premium tbody td {
    padding: 1.2rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    font-weight: 500;
}

.table-premium tbody tr {
    transition: var(--transition-smooth);
}

.table-premium tbody tr:hover {
    background-color: var(--color-surface);
}

.btn-guinda {
    background-color: var(--color-guinda);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: var(--transition-smooth);
}

.btn-guinda:hover {
    background-color: var(--color-guinda-hover);
    color: white;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Animated Collapse Icon */
.icon-collapse {
    transition: transform 0.3s ease;
}

[data-bs-toggle="collapse"][aria-expanded="false"] .icon-collapse {
    transform: rotate(-90deg);
}

/* --- Pinned/Collapsed Sidebar Logic --- */
@media (min-width: 993px) {
    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) {
        width: var(--sidebar-width-collapsed);
    }

    .app-layout.sidebar-collapsed .app-main-workspace {
        margin-left: var(--sidebar-width-collapsed);
        width: calc(100vw - var(--sidebar-width-collapsed));
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .brand-text,
    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .nav-label,
    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .nav-section-title,
    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .icon-collapse,
    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .user-details {
        opacity: 0;
        visibility: hidden;
        display: none;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .nav-item-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .brand-link {
        justify-content: center;
        padding: 0;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .sidebar-header {
        padding-left: 0;
        padding-right: 0;
        align-items: center;
        display: flex;
        justify-content: center;
        flex-direction: column;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) #pinSidebarBtn {
        display: none;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .sidebar-footer {
        padding-left: 0;
        padding-right: 0;
        display: flex;
        justify-content: center;
    }

    .app-layout.sidebar-collapsed .app-sidebar:not(:hover) .user-info {
        justify-content: center;
    }
}