/* ========================================== */
/* 1. BLOKADA WORDPRESSA I UKRYCIE SZABLONU   */
/* ========================================== */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto !important; /* Globalna blokada suwaka, żeby zabić puste przestrzenie */
    background: #f1f5f9 !important;
}
header, #header, .site-header, #masthead, .ast-main-header-wrap,
footer, #footer, .site-footer, #colophon, .site-branding, .logo,
.custom-logo-link, .nav-menu, .main-navigation, .page-title,
.page-header, .entry-header, h1.entry-title, .title-bar,
#wpadminbar {
    display: none !important;
}

/* ========================================== */
/* 2. GŁÓWNA RAMA SYSTEMU (NAKŁADKA NA EKRAN) */
/* ========================================== */
#sw-master {
    --primary: #0f172a; --accent: #3b82f6; --green: #10b981;
    --yellow: #f59e0b; --orange: #f97316; --purple: #8b5cf6;
    --red: #ef4444; --bg: #f8fafc; --card-bg: #ffffff;
    --text: #1e293b; --text-muted: #64748b; --border: #cbd5e1;
    --sidebar-width: 260px;
    font-family: 'Inter', sans-serif; color: var(--text); line-height: 1.5;

    /* PANCERNA KOTWICA - Ignoruje wszystkie marginesy WordPressa */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    
    background-color: #f1f5f9 !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}
#sw-master * { box-sizing: border-box; }

#sw-master #sw-main-view {
    position: absolute !important;
    top: 0 !important; bottom: 0 !important;
    left: 0 !important; right: 0 !important;
    padding: 0 !important; margin: 0 !important;
}

/* ========================================== */
/* 3. MENU BOCZNE                             */
/* ========================================== */
#sw-master .tab-menu {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important; /* Automatycznie dociąga czarne menu do samej podłogi */
    left: 0 !important;
    width: var(--sidebar-width) !important;
    background: #292524 !important;
    z-index: 10 !important;
    overflow-y: auto !important;
    display: flex !important; flex-direction: column !important;
    padding: 0 !important; margin: 0 !important; transition: transform 0.3s ease;
}
#sw-master .tab-menu .tab-btn { background: transparent !important; color: #a8a29e !important; border: none !important; border-left: 4px solid transparent !important; border-radius: 0 !important; text-align: left !important; padding: 15px 25px !important; margin: 0 !important; font-size: 13px !important; white-space: normal !important; width: 100% !important; display: block !important; cursor: pointer; transition: 0.2s; font-weight: 700; }
#sw-master .tab-menu .tab-btn:hover { background: #44403c !important; color: white !important; }
#sw-master .tab-menu .tab-btn.active { background: #1c1917 !important; color: white !important; border-left-color: var(--orange) !important; }
#sw-master .tab-menu .tab-btn[style*="display: none"] { display: none !important; }

/* ========================================== */
/* 4. OBSZAR ROBOCZY (WŁAŚCIWY SCROLL!)       */
/* ========================================== */
#sw-master .tab-content {
    position: fixed !important; /* <--- ZMIANA: Z absolute na fixed (odblokowuje kółko) */
    top: 0 !important;
    bottom: 0 !important; 
    right: 0 !important; /* <--- DODANO: Dociąga tabelę do prawej krawędzi monitora */
    left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    
    overflow-y: auto !important; 
    -webkit-overflow-scrolling: touch !important; 
    
    padding: 40px !important;
    padding-bottom: 80px !important; /* Bezpieczny margines na dole, żeby nic nie ucięło */
    background-color: #f1f5f9 !important;
    display: none !important;
    margin: 0 !important;
}
#sw-master .tab-content.active { display: block !important; }
#sw-master .tab-content > div, #sw-master .tab-content > form {
    width: 100% !important; max-width: 1400px !important;
    margin: 0 auto 30px auto !important;
}

/* ========================================== */
/* 5. WERSJA MOBILNA (TELEFONY I TABLETY)     */
/* ========================================== */
#sw-mobile-toggle { display: none; } 
@media (max-width: 768px) {
    #sw-mobile-toggle {
        display: flex !important; align-items: center; justify-content: center;
        position: fixed; top: 15px; left: 15px; z-index: 100000;
        background: var(--orange); color: white; border: none; width: 45px; height: 45px; 
        border-radius: 8px; font-size: 24px; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }
    #sw-master .tab-menu { transform: translateX(-100%) !important; z-index: 20 !important; }
    #sw-master .tab-menu.open { transform: translateX(0) !important; }
    #sw-master .tab-content { 
        left: 0 !important; 
        width: 100vw !important; 
        padding: 80px 10px 20px 10px !important; 
    }
    #sw-master .tab-content > div, #sw-master .section-wrapper { overflow-x: auto !important; width: 100% !important; }
    #sw-master .cal-grid, #sw-master .class-matrix, #sw-master .report-table { min-width: 700px !important; }
}

/* ========================================== */
/* 6. STYLE FORMULARZY I PRZYCISKĂ“W SYSTEMU   */
/* ========================================== */
#sw-master .sw-input { width: 100%; padding: 12px 15px !important; border: 2px solid var(--border) !important; border-radius: 10px !important; font-size: 13px; margin-bottom: 15px; font-weight: 600; background: #fff !important; color: var(--text) !important; outline: none !important; box-shadow: none !important; font-family: 'Inter', sans-serif; }
#sw-master .sw-input:focus { border-color: var(--accent) !important; }
#sw-master select.sw-input { appearance: auto !important; -webkit-appearance: menulist !important; background-image: none !important; cursor: pointer; }
#sw-master .sw-btn { background: var(--accent) !important; color: white !important; padding: 14px 20px !important; border: none !important; border-radius: 12px !important; font-weight: 800 !important; cursor: pointer; transition: 0.2s; text-transform: uppercase; font-size: 12px; display: inline-block; text-align: center; font-family: 'Inter', sans-serif; margin: 0; width: 100%; }
#sw-master .sw-btn:hover { opacity: 0.9; transform: translateY(-1px); }
#sw-master .sw-btn-sm { padding: 8px 12px !important; font-size: 11px !important; border-radius: 8px !important; width: auto;}
#sw-master .sw-btn-outline { background: transparent !important; color: var(--text) !important; border: 2px solid var(--border) !important; }

#sw-login-view { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; padding: 60px 20px; width: 100%; }
#sw-master .sw-login-box { background: var(--card-bg); padding: 40px; border-radius: 24px; width: 100%; max-width: 420px; text-align: center; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); border: 1px solid var(--border); }
#sw-master .section-wrapper { background: var(--card-bg); padding: 25px; border-radius: 20px; margin-bottom: 30px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
#sw-master .section-title { font-size: 16px; font-weight: 900; color: var(--primary); text-transform: uppercase; margin-top: 0; margin-bottom: 20px; border-bottom: 2px solid var(--bg); padding-bottom: 15px; display:flex; justify-content:space-between; align-items:center; flex-wrap: wrap; gap: 10px; }
#sw-master .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 20px; align-items: end; }
#sw-master .form-grid label { display: block; font-weight: 800; margin-bottom: 8px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
#sw-master .card { background: var(--card-bg); border-radius: 20px; margin-bottom: 20px; border: 1px solid var(--border); border-left: 8px solid var(--accent); overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
#sw-master .card-header { padding: 20px 25px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-bottom: 1px solid var(--bg); background: #f8fafc; flex-wrap:wrap; gap:15px;}
#sw-master .progress-container { width: 100%; background: #e2e8f0; height: 20px; border-radius: 10px; margin-top: 10px; position: relative; overflow: hidden; border: 1px solid var(--border); }
#sw-master .progress-fill { height: 100%; background: var(--green); transition: width 0.5s ease; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:900; color:white; text-shadow:0 1px 2px rgba(0,0,0,0.5);}
#sw-master .task-btn { cursor: pointer; padding: 12px 10px; border-radius: 12px; border: 1px solid var(--border); background: #fff; min-height: 90px; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; font-size: 10px; font-weight: 700; text-align: center; transition:0.2s;}
#sw-master .task-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05);}
#sw-master .task-btn.working { background: #fffbeb; border-color: #fcd34d; color: #92400e; border-width: 2px; }
#sw-master .task-btn.done { background: #f0fdf4; border-color: #86efac; color: #166534; }
#sw-master .task-btn.paused { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
#sw-master .task-btn.problem { background: #fef2f2; border-color: #f87171; color: #b91c1c; border-width: 2px; }
#sw-master .task-history-row { font-size: 9px; border-top: 1px solid rgba(0,0,0,0.05); width: 100%; padding-top: 4px; margin-top: 4px; color: var(--text-muted); line-height: 1.2; text-align: left;}
#sw-master .report-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--border);}
#sw-master .report-table th { background: var(--bg); padding: 12px 15px; text-align: left; font-size: 11px; text-transform: uppercase; font-weight: 800; color: var(--text-muted); border-bottom: 2px solid var(--border);}
#sw-master .report-table td { padding: 12px 15px; border-bottom: 1px solid var(--bg); font-size: 13px; }
#sw-master .status-badge { padding: 6px 12px; border-radius: 20px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
#sw-master .class-group-header { background: var(--primary); color: white; padding: 10px 15px; border-radius: 10px; font-weight: 900; font-size: 12px; margin: 25px 0 10px; text-transform: uppercase; letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; }
#sw-master .workcard-panel { background: var(--card-bg); border: 2px solid var(--accent); border-radius: 20px; padding: 30px; text-align: center; margin-bottom: 30px; box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.1);}
#sw-master .timer-display { font-size: 42px; font-weight: 900; font-family: monospace; color: var(--primary); margin: 15px 0; }
#sw-master .chat-msg { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-bottom: 15px; }
.tablet-checkbox { transform: scale(1.8); margin: 5px; cursor: pointer; }

/* Modale */
.sw-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); z-index: 999999; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.sw-modal-content { background: #fff; padding: 35px; border-radius: 24px; width: 95%; max-width: 700px; position: relative; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.sw-modal-close { position: absolute; right: 20px; top: 20px; border: none; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: 0.2s; font-weight: bold;}
.sw-modal-close:hover { background: var(--red); color: white; }

/* Kalendarz */
#sw-master .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 15px;}
#sw-master .cal-header { text-align: center; font-weight: 900; font-size: 12px; color: var(--text-muted); text-transform: uppercase; padding-bottom: 10px; }
#sw-master .cal-day { min-height: 110px; background: #fff; border: 2px solid var(--border); border-radius: 16px; padding: 10px; cursor: pointer; transition: 0.2s; position: relative; display:flex; flex-direction:column;}
#sw-master .cal-day:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); z-index:10;}
#sw-master .cal-day.empty { background: transparent; border: 1px dashed var(--border); cursor: default; box-shadow:none;}
#sw-master .cal-day.empty:hover { transform: none; border-color: var(--border); }
#sw-master .cal-date { font-weight: 900; font-size: 18px; margin-bottom: 5px; color: var(--primary);}
#sw-master .cal-entry { background: var(--bg); border:1px solid var(--border); font-size: 10px; padding: 4px 6px; border-radius: 6px; border-left: 4px solid var(--accent); margin-bottom: 4px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
#sw-master .cal-day.partial { background: #fff7ed; border-color: #fdba74; }
#sw-master .cal-day.full { background: #fef2f2; border-color: #fca5a5; opacity: 0.8;}
#sw-master .class-matrix { display: grid; grid-template-columns: 35px repeat(7, 1fr); gap: 6px; justify-content: center; background:var(--bg); padding:15px; border-radius:16px;}
#sw-master .matrix-label { display: flex; align-items: center; justify-content: center; font-weight: 900; color: var(--text-muted); font-size: 13px; }
#sw-master .class-btn { background: white !important; border: 2px solid var(--border) !important; border-radius: 8px !important; padding: 10px 0 !important; cursor: pointer; font-size: 12px; font-weight: 800; text-align: center; transition: 0.2s; color: var(--text) !important; box-shadow: 0 2px 4px rgba(0,0,0,0.05);}
#sw-master .class-btn:hover { border-color: var(--accent) !important; color: var(--accent) !important; transform: translateY(-1px); }
#sw-master .class-btn.selected { background-color: var(--accent) !important; color: white !important; border-color: var(--accent) !important; }