/* Elite Frameless Design System - Settings Hub */
@import url("forms.css");
@import url("sidebar.css");

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-main: #fcfcfc;
    --sidebar-main: #1f2937;
    --sub-sidebar-bg: #ffffff;
    --accent-blue: #2563eb;
    --accent-blue-soft: #f3f4f6;
    --accent: var(--accent-blue);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --border-soft: #e5e7eb;
    --shadow-sm: none;
    --shadow-md: none;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sub-sidebar-width: 260px;
    --radius-lg: 8px;
    --radius-md: 6px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Layout Hierarchy - Using Grid for stability */
.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: auto !important;
    min-height: 100vh;
    align-items: start;
}

.app-container.has-sub-sidebar {
    grid-template-columns: var(--sidebar-width) var(--sub-sidebar-width) 1fr;
    align-items: start;
}

.app-container > .panel-sidebar {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

.app-container > .main-content {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

.app-container.has-sub-sidebar > .sub-sidebar {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

.app-container.has-sub-sidebar > .main-content {
    grid-column: 3 !important;
    grid-row: 1 !important;
}

.panel-sidebar {
    width: var(--sidebar-width) !important;
    grid-column: 1;
    flex-shrink: 0;
    position: fixed;
    top: 34px;
    left: 0;
    height: calc(100vh - 34px);
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
}

.app-container.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.app-container.has-sub-sidebar.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) var(--sub-sidebar-width) 1fr;
}

.sub-sidebar {
    width: var(--sub-sidebar-width);
    background: var(--sub-sidebar-bg);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 34px;
    left: var(--sidebar-width);
    height: calc(100vh - 34px);
    z-index: 50;
    padding-top: 24px;
    margin-top: 0 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-collapsed .sub-sidebar {
    left: var(--sidebar-collapsed-width);
}

.sub-sidebar-header {
    padding: 0 24px 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
    margin-top: 30px;
}

.sub-sidebar-header h3 {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.sub-sidebar-header p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 600;
}

.sub-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 32px;
}

.nav-group-label {
    padding: 24px 24px 8px;
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-group-label i {
    margin-right: 8px;
}

.sub-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
}

.sub-nav-item:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.sub-nav-item.active {
    background: #eff6ff;
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    font-weight: 700;
}

.sub-nav-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

.sidebar-separator {
    height: 1px;
    background: #f1f5f9;
    margin: 12px 24px;
}

.main-content {
    padding: 40px 64px;
    overflow-y: auto;
}

/* Common Components */
.breadcrumb {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb a {
    color: var(--accent-blue);
    text-decoration: none;
}

.breadcrumb span.active {
    color: #1e293b;
    font-weight: 700;
}

.breadcrumb i {
    font-size: 10px;
    opacity: 0.5;
}

.breadcrumb .mobile-toggle {
    margin-right: 12px;
}

.settings-section-header {
    margin-bottom: 40px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 24px;
}

.settings-section-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.settings-section-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

.settings-card {
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.table-container {
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.settings-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.settings-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
}

.settings-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.settings-table tbody tr:hover {
    background: #f8fafc;
}

.settings-table td {
    padding: 10px 20px;
    color: #64748b;
    vertical-align: middle;
}

.settings-table tr:last-child td {
    border-bottom: none;
}

/* Forms and Buttons are unified in forms.css */

/* --- ELITE FULL-SCREEN MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Full Screen Modal that respects Sidebar and Quick Nav */
.modal-overlay.full-screen {
    position: fixed;
    top: 34px; /* Quick Nav height */
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 9998;
    display: none;
    flex-direction: column;
    padding: 0;
    backdrop-filter: none;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-collapsed .modal-overlay.full-screen {
    left: var(--sidebar-collapsed-width);
}

.modal-content-full {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header-full {
    padding: 32px 48px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body-full {
    flex: 1;
    overflow-y: auto;
    padding: 64px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.modal-footer-full {
    padding: 32px 48px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    background: #fcfdfe;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile adjustments for full screen modal */
@media (max-width: 1024px) {
    .modal-overlay.full-screen {
        left: 0 !important;
        top: 32px; /* Mobile Quick Nav height */
    }
}

/* Mobile Responsive adjustments */
@media (max-width: 1024px) {
    .sub-sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        left: auto !important;
        z-index: 900;
        padding: 12px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-soft);
        background: #ffffff;
    }

    .app-container {
        display: block; /* Collapse grid to single column */
        position: relative;
    }

    .app-container.has-sub-sidebar {
        display: block;
    }

    .sub-sidebar-header {
        padding: 0 16px 8px;
    }
    
    .sub-sidebar-header h3 {
        font-size: 16px;
        margin-top: 5px;
    }
    
    .sub-sidebar-header p {
        display: none;
    }

    .sub-sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 4px 16px;
        gap: 8px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .sub-sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sub-nav-item {
        white-space: nowrap;
        padding: 8px 16px;
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: 6px;
        background: #f8fafc;
        flex-shrink: 0;
    }

    .sub-nav-item.active {
        background: #eff6ff;
        border-bottom-color: var(--accent-blue);
    }

    .sub-nav-label, .nav-group-label {
        display: none !important;
    }

    .main-content {
        padding: 24px;
        width: 100%;
    }

    .form-grid, .summary-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .settings-card {
        padding: 16px;
    }

    .table-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .settings-table th, .settings-table td {
        padding: 12px;
        font-size: 12px;
    }

    .settings-table th:nth-child(n+4),
    .settings-table td:nth-child(n+4) {
        display: none;
    }
}

/* Office Buttons & Badges */
.btn-office-primary {
    background: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 11px;
}
.btn-office-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-office-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 11px;
}
.btn-office-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-badge.pracuje { background: #dcfce7; color: #059669; }
.status-badge.oczekuje { background: #f1f5f9; color: #64748b; }
.status-badge.nieobecny { background: #fee2e2; color: #b91c1c; }

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-2px);
}

.btn-action.btn-print:hover {
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.btn-action.btn-edit:hover {
    color: #f59e0b;
    background: #fffbeb;
    border-color: #fde68a;
}

.btn-action.btn-delete:hover {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}

