/* Подключение внешнего шрифта */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-main: #070708;
    --bg-card: #121214;
    --bg-item: #18181b;
    --text-main: #ffffff;
    --text-muted: #71717a;
    --border: rgba(255,255,255,0.1);
    --table-border: rgba(255, 255, 255, 0.15);
    --accent: #3b82f6;
    --nav-bg: rgba(18, 18, 20, 0.95);
    color-scheme: dark;

    --color-day: #10b981;
    --color-night: #5d6dfa;
    --color-spec: #f59e0b;
    --color-vacation: #3f3f46;
    --color-trip: #a855f7;
    
    /* Фон в стиле Telegram (тёмная тема) */
    --bg-pattern: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.01) 0px,
        rgba(255, 255, 255, 0.01) 2px,
        transparent 2px,
        transparent 8px
    ),
    repeating-linear-gradient(
        135deg,
        rgba(150, 180, 255, 0.02) 0px,
        rgba(150, 180, 255, 0.02) 2px,
        transparent 2px,
        transparent 10px
    ),
    radial-gradient(circle at 20% 30%, rgba(100, 150, 255, 0.03) 0%, transparent 20%),
    radial-gradient(circle at 80% 70%, rgba(100, 200, 255, 0.03) 0%, transparent 25%);
}

.light-mode {
    --bg-main: #f4f4f7;
    --bg-card: #ffffff;
    --bg-item: #fdfdfe;
    --text-main: #000000;
    --text-muted: #707579;
    --border: rgba(0,0,0,0.08);
    --table-border: rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.95);
    color-scheme: light;
    
    --color-vacation: #d4d4d8;
    --color-trip: #7e22ce;
    
    /* Фон в стиле Telegram (светлая тема) */
    --bg-pattern: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.01) 0px,
        rgba(0, 0, 0, 0.01) 2px,
        transparent 2px,
        transparent 8px
    ),
    repeating-linear-gradient(
        135deg,
        rgba(100, 120, 200, 0.02) 0px,
        rgba(100, 120, 200, 0.02) 2px,
        transparent 2px,
        transparent 10px
    ),
    radial-gradient(circle at 20% 30%, rgba(50, 100, 200, 0.02) 0%, transparent 20%),
    radial-gradient(circle at 80% 70%, rgba(50, 150, 200, 0.02) 0%, transparent 25%);
}

body { 
    font-family: 'Manrope', sans-serif; 
    background-color: var(--bg-main);
    background-image: var(--bg-pattern);
    background-size: 200px 200px, 200px 200px, cover, cover;
    background-repeat: repeat, repeat, no-repeat, no-repeat;
    color: var(--text-main);
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

.tab-content {
    display: none !important;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(5px);
}
.tab-content.active {
    display: flex !important;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
}

#block-modal {
    transition: opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
    display: flex !important;
}
#block-modal.hidden {
    opacity: 0;
    pointer-events: none;
}
#block-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.header-icon-main {
    width: 70px; height: 70px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    backdrop-filter: blur(10px);
}

.action-btn { background-color: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); transition: 0.2s; backdrop-filter: blur(10px); }
.action-btn:active { transform: scale(0.97); opacity: 0.8; }

.schedule-container {
    overflow-x: auto; 
    border-radius: 24px; 
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    width: 100%;
    padding-top: 5px;
    padding-bottom: 12px;
    backdrop-filter: blur(10px);
}

.schedule-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; }

.schedule-table th, .schedule-table td {
    font-size: 9px; 
    width: 34px;    
    height: 38px;   
    text-align: center; 
    border-right: 1px solid var(--table-border);
    border-bottom: 1px solid var(--table-border);
    color: var(--text-main);
    vertical-align: middle;
    transition: background-color 0.2s;
    position: relative; /* для позиционирования цифры внутри */
}

.shift-D, .shift-N, .shift-S, .shift-О, .shift-K { position: relative; }

.shift-D::after, .shift-N::after, .shift-S::after, .shift-О::after, .shift-K::after {
    content: ''; position: absolute; inset: 6px; border-radius: 5px;
}

.shift-D::after { background-color: var(--color-day); }
.shift-N::after { background-color: var(--color-night); }
.shift-S::after { background-color: var(--color-spec); }
.shift-О::after { background-color: var(--color-vacation); }
.shift-K::after { background-color: var(--color-trip); }

/* Цифра внутри дневной смены (часы) */
.hour-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 10px;
    color: #064e3b; /* тёмно-зелёный, хорошо читается */
    z-index: 1;
    line-height: 1;
}
.light-mode .hour-num {
    color: #064e3b;
}

.today-column {
    background-color: rgba(59, 130, 246, 0.08) !important;
    position: relative;
}
.today-header {
    color: var(--accent) !important;
    font-weight: 900 !important;
    background: rgba(59, 130, 246, 0.15) !important;
}
.today-header::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: var(--accent);
    border-radius: 50%;
}

.head-fio { 
    color: var(--accent) !important; 
    background: var(--bg-item) !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 900 !important;
    border-bottom: 2px solid var(--accent) !important;
    text-align: center !important;
    font-size: 11px !important;
}

.col-name { 
    position: sticky; left: 0; z-index: 20; 
    width: 150px !important; 
    background-color: var(--bg-card) !important; 
    font-weight: 800; 
    font-size: 11px !important;
    text-align: center !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    border-right: 2px solid var(--accent) !important;
    white-space: nowrap !important;
    text-overflow: ellipsis;
}
.col-stat { width: 44px !important; font-weight: 900; background: rgba(59, 130, 246, 0.05); color: var(--accent); }

.card-bg { background-color: var(--bg-card); backdrop-filter: blur(10px); }

.month-picker-wrapper {
    position: relative; display: inline-flex; align-items: center;
    background: var(--bg-item); border: 1px solid var(--border);
    padding: 10px 20px; border-radius: 14px; color: var(--text-main); font-weight: 800;
    backdrop-filter: blur(10px);
}
#month-selector { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.legend-badge {
    display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase;
    background: var(--bg-item); padding: 6px 12px; border-radius: 100px; border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.highlighted-row { background-color: rgba(59, 130, 246, 0.05) !important; }
.blurred-row { opacity: 0.15 !important; filter: blur(2px); pointer-events: none; }

.custom-nav {
    height: 72px; border-radius: 24px; background-color: var(--nav-bg); border: 1px solid var(--border);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0.4; transition: opacity 0.2s; }
.nav-item.active { opacity: 1; color: var(--accent); }
.nav-label { font-size: 9px; font-weight: 800; text-transform: uppercase; margin-top: 4px; }

.theme-toggle {
    position: fixed; 
    top: calc(env(safe-area-inset-top) + 15px);
    right: 20px; 
    width: 44px; 
    height: 44px; 
    border-radius: 14px;
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.doc-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; background: var(--bg-item); border-radius: 20px;
    border: 1px solid var(--border); color: var(--text-main);
    text-decoration: none; transition: 0.2s;
    backdrop-filter: blur(10px);
}
.doc-name { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.doc-item:active { transform: scale(0.97); background: var(--border); }

.update-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    width: 90%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #ffffff;
}
.light-mode .update-toast {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #000000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}
.update-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}
.update-action-btn {
    width: 100%;
    background: #3b82f6;
    color: #ffffff;
    padding: 14px;
    border-radius: 18px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}
.update-action-btn:active {
    transform: scale(0.96);
    background: #2563eb;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

::-webkit-scrollbar { width: 0px; background: transparent; }

.holiday-header {
    background: rgba(220, 110, 110, 0.12) !important;
    color: #c86868 !important;
}
.holiday-column {
    background: rgba(220, 110, 110, 0.05) !important;
    position: relative;
}
.light-mode .holiday-header {
    background: rgba(220, 110, 110, 0.18) !important;
    color: #b85858 !important;
}
.light-mode .holiday-column {
    background: rgba(220, 110, 110, 0.08) !important;
}

.correct-answer {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}
.wrong-answer {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

#block-modal {
    transition: opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
    display: flex !important;
}
#block-modal.hidden {
    opacity: 0;
    pointer-events: none;
}
#block-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

#weather-widget {
    transition: opacity 0.3s ease;
}
#weather-widget:empty {
    opacity: 0;
}

.text-glow {
    color: #e0e7ff;
    text-shadow: 0 0 12px rgba(99, 102, 241, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.01em;
}
.light-mode .text-glow {
    color: #1e293b;
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.3), 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* Улучшенная видимость полей калькулятора в светлой теме */
.calc-input {
    background-color: var(--bg-item) !important;
    border: 1px solid var(--border) !important;
}
.light-mode .calc-input {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    color: #000000 !important;
}