/* ===========================================
 * SRZ Krúžky - Hlavný stylesheet
 * Farby: #4CAF50 (primárna), #2196F3 (sekundárna)
 * Font: system-ui (Nunito pre produkciu)
 * =========================================== */

/* --- CSS Custom Properties --- */
:root {
    --color-primary: #4CAF50;
    --color-primary-dark: #388E3C;
    --color-primary-light: #C8E6C9;
    --color-secondary: #2196F3;
    --color-secondary-dark: #1976D2;

    --color-success: #4CAF50;
    --color-warning: #FF9800;
    --color-error: #F44336;
    --color-info: #2196F3;

    --color-bg: #F5F5F5;
    --color-card: #FFFFFF;
    --color-text: #1A1A2E;
    --color-text-secondary: #666666;
    --color-border: #E0E0E0;
    --color-bg-hover: rgba(0, 0, 0, 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-card: 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);

    --sidebar-width: 260px;
    --topbar-height: 60px;
    --bottom-nav-height: 64px;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --color-bg: #1A1A2E;
    --color-card: #16213E;
    --color-text: #E0E0E0;
    --color-text-secondary: #A0A0A0;
    --color-border: #2A2A4A;
    --color-bg-hover: rgba(255, 255, 255, 0.08);
    --color-primary-light: rgba(76, 175, 80, 0.15);
    --shadow-card: 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .auth-layout {
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #1A1A2E 100%);
}

[data-theme="dark"] .auth-card {
    background: rgba(22, 33, 62, 0.95);
    border-color: var(--color-border);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Layout: Auth (centrovaný formulár) --- */
.auth-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    background:
        linear-gradient(135deg,
            #e8f5e9 0%,
            #e3f2fd 30%,
            #f3e5f5 60%,
            #e3f2fd 80%,
            #e8f5e9 100%
        );
    overflow: hidden;
}

.auth-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.auth-logo .subtitle {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* --- Layout: Main (sidebar + content) --- */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-card);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-logo h2 {
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
    font-weight: 700;
    border-right: 3px solid var(--color-primary);
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-badge {
    margin-left: auto;
    background: var(--color-warning, #FF9800);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.4375rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
    line-height: 1.2;
}

.sidebar.collapsed .nav-badge {
    display: none;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-header {
    margin-bottom: 1.5rem;
}

.content-header h1 {
    font-size: 1.5rem;
    color: var(--color-text);
}

.content-header .subtitle {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* --- Bottom Navigation (mobile) --- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.bottom-nav-items {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: space-around;
}

.bottom-nav-items a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--color-text-secondary);
    font-size: 0.625rem;
    font-weight: 500;
    text-decoration: none;
}

.bottom-nav-items a.active {
    color: var(--color-primary);
}

.bottom-nav-items .nav-icon {
    font-size: 1.25rem;
}

/* --- Sidebar Toggle Button --- */
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0.25rem;
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}

.sidebar-toggle:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.sidebar .toggle-expand {
    display: none;
}

.sidebar-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 1.2em;
    padding: 0;
    transition: color 0.15s ease;
}

.sidebar-logout:hover {
    color: var(--color-error);
}

/* --- Theme Toggle Button --- */
.sidebar-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}

.sidebar-theme-toggle:hover {
    color: var(--color-warning);
    background: rgba(255, 152, 0, 0.1);
}

/* Light mode: show sun icon, hide moon */
.theme-icon-dark { display: none; }
.theme-icon-light { display: block; }

/* Dark mode: show moon icon, hide sun */
[data-theme="dark"] .theme-icon-dark { display: block; }
[data-theme="dark"] .theme-icon-light { display: none; }

/* --- Card Theme Toggle (auth/landing pages, nad logom) --- */
.card-theme-toggle-row {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.card-theme-toggle {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.card-theme-toggle:hover {
    color: var(--color-warning);
    border-color: var(--color-warning);
    background: rgba(255, 152, 0, 0.08);
    transform: rotate(15deg);
}

[data-theme="dark"] .card-theme-toggle {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Sidebar Collapsed --- */
.sidebar {
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .toggle-collapse {
    display: none;
}

.sidebar.collapsed .toggle-expand {
    display: block;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .sidebar-toggle {
    margin-left: 0;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-nav .nav-icon {
    width: auto;
    font-size: 1.15em;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-user .user-info {
    display: none;
}

.sidebar.collapsed + .content-wrapper,
.sidebar.collapsed ~ .content-wrapper {
    margin-left: 64px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .content-wrapper {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    }

    .bottom-nav {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}
