/* =============================================
   BD Za Korunou — Stylesheet
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #D4845A;
    --primary-dark: #B8694A;
    --primary-light: #F0C4A8;
    --dark: #2C3E50;
    --dark-light: #34495E;
    --text: #333333;
    --text-light: #666666;
    --bg: #F5F6F8;
    --white: #FFFFFF;
    --border: #E0E0E0;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --max-width: 1100px;
    --transition: 0.25s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary-dark); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* --- Header --- */
.site-header {
    background: var(--dark);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    text-decoration: none;
    flex-shrink: 0;
}

.logo:hover { color: var(--primary-light); }

.logo-icon { font-size: 1.75rem; }

.logo-text strong {
    display: block;
    font-size: 1.05rem;
    line-height: 1.2;
}

.logo-text small {
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 400;
}

/* --- Navigation --- */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.12);
}

.main-nav a.active {
    background: var(--primary);
}

.nav-login {
    background: var(--primary) !important;
    color: var(--white) !important;
}

.nav-login:hover {
    background: var(--primary-dark) !important;
}

.nav-logout {
    font-size: 0.8rem !important;
    opacity: 0.7;
}

.nav-admin {
    color: var(--warning) !important;
}

/* --- Hamburger --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- Main Content --- */
.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* --- Page Hero --- */
.page-hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    color: var(--white);
    padding: 2.5rem 0;
    margin: -2rem 0 2rem;
    text-align: center;
}

.page-hero h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.page-hero p {
    opacity: 0.8;
    font-size: 1rem;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bg);
}

.card-header h2 {
    font-size: 1.3rem;
    color: var(--dark);
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--dark);
}

/* --- News Items --- */
.news-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}

.news-item-date {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.news-item h2 {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.news-item-content {
    line-height: 1.7;
}

.news-item-content p { margin-bottom: 0.75rem; }
.news-item-content ul, .news-item-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.news-item-content li { margin-bottom: 0.3rem; }

/* --- Documents --- */
.doc-list { list-style: none; }

.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.doc-item:last-child { border-bottom: none; }

.doc-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.doc-icon { font-size: 1.5rem; flex-shrink: 0; }

.doc-meta h3 {
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 0.15rem;
}

.doc-meta small {
    color: var(--text-light);
    font-size: 0.8rem;
}

.doc-download {
    flex-shrink: 0;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-dark {
    background: var(--dark);
    color: var(--white);
}
.btn-dark:hover {
    background: var(--dark-light);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: #219A52;
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #C0392B;
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 132, 90, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

/* --- Alerts --- */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #D5F5E3;
    color: #1E8449;
    border-color: #A9DFBF;
}

.alert-error {
    background: #FADBD8;
    color: #C0392B;
    border-color: #F5B7B1;
}

.alert-warning {
    background: #FEF9E7;
    color: #9A7D0A;
    border-color: #F9E79F;
}

.alert-info {
    background: #D6EAF8;
    color: #2471A3;
    border-color: #AED6F1;
}

/* --- Login Page --- */
.login-wrapper {
    max-width: 420px;
    margin: 2rem auto;
}

.login-wrapper .card {
    text-align: center;
}

.login-wrapper h1 {
    font-size: 1.4rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.login-wrapper .login-subtitle {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-wrapper .form-group { text-align: left; }
.login-wrapper .btn { width: 100%; justify-content: center; }

/* --- Contacts --- */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.contact-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
}

.contact-card .role {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.contact-card .name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.6rem;
}

.contact-card .phone {
    color: var(--text-light);
    font-size: 0.95rem;
}

.contact-card .phone a {
    color: var(--dark);
    font-weight: 500;
}

.map-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.map-wrapper iframe {
    width: 100%;
    height: 350px;
    border: 0;
}

/* --- Fault Form --- */
.entrance-options {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* --- Table --- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

tr:hover { background: #FAFAFA; }

/* --- Status Badges --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-new { background: #D6EAF8; color: #2471A3; }
.badge-progress { background: #FEF9E7; color: #9A7D0A; }
.badge-done { background: #D5F5E3; color: #1E8449; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--dark); margin-bottom: 0.5rem; }

/* --- Admin --- */
.admin-header {
    background: var(--dark);
    color: var(--white);
    padding: 0.75rem 0;
    border-bottom: 3px solid var(--warning);
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-nav a {
    color: rgba(255,255,255,0.8);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.admin-nav a:hover, .admin-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.12);
}

.admin-nav .back-link {
    margin-left: auto;
    color: var(--primary-light);
}

.admin-title {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bg);
}

.admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* --- Footer --- */
.site-footer {
    background: var(--dark);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.85rem;
    margin-top: auto;
}

.site-footer a { color: var(--primary-light); }
.footer-email { margin-top: 0.3rem; }

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }

.confirm-delete {
    display: inline;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0.25rem;
        transform: translateY(-120%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
        z-index: 999;
    }

    .main-nav.open {
        transform: translateY(0);
    }

    .main-nav a {
        padding: 0.75rem 1rem;
        width: 100%;
        text-align: left;
        font-size: 1rem;
    }

    .page-hero h1 { font-size: 1.4rem; }

    .header-inner {
        min-height: 56px;
    }

    .logo-text strong { font-size: 0.9rem; }
    .logo-text small { font-size: 0.7rem; }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .doc-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-nav .back-link { margin-left: 0; }

    table { font-size: 0.8rem; }
    th, td { padding: 0.5rem; }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .entrance-options {
        flex-direction: column;
        gap: 0.5rem;
    }
}
