/* opravil_opti-node – Evidence zemních šachet optických sítí
   Barevné schéma: šedá + ocelově modrá */

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

:root {
    /* Ocelově modrá */
    --steel-blue: #4682b4;
    --steel-blue-dark: #3a6d95;
    --steel-blue-light: #5b9bd5;
    --steel-blue-muted: rgba(70, 130, 180, 0.15);

    /* Šedá */
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #adb5bd;
    --gray-400: #6c757d;
    --gray-500: #495057;
    --gray-600: #343a40;
    --gray-700: #212529;

    --primary: var(--steel-blue);
    --primary-hover: var(--steel-blue-dark);
    --accent: var(--steel-blue-light);
    --bg: var(--gray-100);
    --bg-card: #fff;
    --text: var(--gray-700);
    --text-muted: var(--gray-500);
    --border: var(--gray-200);
    --shadow: 0 2px 8px rgba(33, 37, 41, 0.08);
    --shadow-hover: 0 4px 16px rgba(33, 37, 41, 0.12);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(160deg, var(--gray-200) 0%, var(--gray-300) 50%, var(--steel-blue-muted) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.app {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--gray-600) 0%, var(--steel-blue-dark) 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: var(--shadow);
}

.header > * {
    flex-shrink: 0;
}

.header-brand {
    flex: 1;
    min-width: 0;
}

.header-brand .logo {
    margin-bottom: 6px;
}

.header .logo {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.header .logo-img {
    height: 60px;
    width: auto;
    display: block;
}

.header .tagline {
    font-size: 0.95rem;
    opacity: 0.9;
    color: var(--gray-200);
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid var(--steel-blue);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--steel-blue);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.nav-btn:hover {
    background: var(--steel-blue);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.nav-btn.active {
    background: var(--steel-blue);
    color: #fff;
    border-color: var(--steel-blue-dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-label {
    font-size: 0.9rem;
    color: var(--gray-200);
}

.file-status {
    font-size: 0.85rem;
    color: var(--gray-200);
    opacity: 0.9;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    font-size: 1.15rem;
    color: var(--steel-blue-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

/* Mapa sítě */
.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.map-toolbar .hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.map-container {
    width: 100%;
    height: 620px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(70, 130, 180, 0.08);
}

.map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 28px;
    border: 1px dashed var(--gray-300);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--text-muted);
    margin-bottom: 16px;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.map-legend .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--steel-blue);
}

.map-legend .legend-line {
    width: 20px;
    height: 2px;
    background: #9bb6cc;
    display: inline-block;
}

/* Admin – Organizace a uživatelé (superadmin) */
.card-admin[hidden] {
    display: none !important;
}

.admin-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.admin-grid--users-only {
    grid-template-columns: 1fr;
}

.admin-block h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.admin-form {
    margin-bottom: 16px;
}

.admin-form .form-group {
    margin-bottom: 12px;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--steel-blue);
    margin-bottom: 8px;
}

.admin-item-info {
    min-width: 0;
    flex: 1;
}

.admin-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--steel-blue-dark);
}

.admin-item-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Form */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group label.mt-texture-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mt-texture-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--gray-300);
    background: #ffffff;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--steel-blue);
    box-shadow: 0 0 0 3px var(--steel-blue-muted);
}

.form-group input[readonly] {
    background: var(--gray-100);
    cursor: default;
}

.form-group textarea {
    resize: vertical;
    min-height: 72px;
}

.form-group .hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Input with action button */
.input-with-action {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-action input {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-primary {
    background: var(--steel-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--steel-blue-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-secondary {
    background: var(--gray-400);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--gray-500);
}

.btn-danger {
    background: var(--gray-500);
    color: #fff;
}

.btn-danger:hover {
    background: var(--gray-600);
}

.btn-block {
    width: 100%;
}

/* List */
.list-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.list-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.list-scope-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: -8px 0 16px 0;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--steel-blue);
    color: var(--steel-blue);
}

.filter-btn.active {
    background: var(--steel-blue);
    border-color: var(--steel-blue);
    color: #fff;
}

/* Sachty list */
.sachty-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sachta-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 10px;
    border-left: 4px solid var(--steel-blue);
    transition: box-shadow 0.2s;
}

.sachta-item:hover {
    box-shadow: var(--shadow);
}

.sachta-item[data-stav="neaktivní"] {
    border-left-color: var(--gray-400);
    opacity: 0.85;
}

.sachta-item[data-stav="v opravě"] {
    border-left-color: var(--steel-blue-light);
}

.sachta-main {
    min-width: 0;
}

.sachta-cislo {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--steel-blue-dark);
    margin-bottom: 4px;
}

.sachta-link {
    color: var(--steel-blue-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.sachta-link:hover {
    color: var(--steel-blue);
    text-decoration: underline;
}

.sachta-lokace {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 6px;
}

.sachta-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sachta-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sachta-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sachta-badge.typ {
    background: var(--steel-blue-muted);
    color: var(--steel-blue-dark);
}

.sachta-badge.org {
    background: var(--gray-200);
    color: var(--gray-600);
}

.sachta-badge.stav-aktivní {
    background: rgba(70, 130, 180, 0.2);
    color: var(--steel-blue-dark);
}

.sachta-badge.stav-neaktivní {
    background: var(--gray-200);
    color: var(--gray-600);
}

.sachta-badge.stav-v opravě {
    background: rgba(91, 155, 213, 0.25);
    color: var(--steel-blue-dark);
}

.sachta-badge.stav-plánovaná {
    background: var(--gray-200);
    color: var(--gray-500);
}

.sachta-adresa {
    font-size: 0.85rem;
    color: var(--text);
    margin-top: 6px;
}

.sachta-poznamka {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

.sachta-zaznamy {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.sachta-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: stretch;
    flex-direction: column;
}

.sachta-actions .btn {
    text-decoration: none;
    width: 100%;
    text-align: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* Footer */
.footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.footer-logo-img {
    height: 18px;
    width: auto;
    display: block;
}

/* Login page */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    padding: 24px 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--gray-600) 0%, var(--steel-blue-dark) 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: var(--shadow);
}

.login-header .logo {
    font-size: 1.5rem;
    margin-bottom: 6px;
    color: #fff;
}

.login-header .logo-img {
    height: 54px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.login-header .tagline {
    font-size: 0.9rem;
    color: var(--gray-200);
}

.login-main {
    margin-bottom: 24px;
}

.login-card {
    padding: 28px;
}

.login-card h2 {
    margin-bottom: 8px;
}

.login-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-error {
    padding: 10px 12px;
    margin-bottom: 16px;
    background: rgba(200, 60, 60, 0.1);
    border: 1px solid rgba(200, 60, 60, 0.3);
    border-radius: 8px;
    color: #c0392b;
    font-size: 0.9rem;
}

.login-error[hidden] {
    display: none !important;
}

.login-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .app {
        padding: 16px 12px;
    }

    .header {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
    }

    .header-brand {
        width: 100%;
    }

    .main-nav {
        justify-content: stretch;
    }
    
    .nav-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .logo {
        font-size: 1.4rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .sachta-item {
        grid-template-columns: 1fr;
    }

    .sachta-actions {
        justify-content: flex-end;
    }

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

    .admin-item {
        flex-wrap: wrap;
    }
}

/* Loading and error messages */
.loading-message {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.error-message {
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(200, 60, 60, 0.1);
    border: 1px solid rgba(200, 60, 60, 0.3);
    border-radius: 8px;
    color: #c0392b;
    font-size: 0.9rem;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.tab-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-actions .btn {
    padding: 10px 18px;
    font-size: 1rem;
    border-radius: 10px;
}

.tab-actions .btn-primary {
    box-shadow: var(--shadow);
}

/* Záznamy */
.zaznamy-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.zaznam-item {
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--steel-blue);
}

.zaznam-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.zaznam-message {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 4px;
}

/* MT tab */
.mt-svg {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: var(--bg-card);
}

.mt-svg svg {
    width: 100%;
    height: auto;
    display: block;
}

.mt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.mt-modal-card {
    max-width: 420px;
    width: 100%;
}

.zaznam-technik {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}
