/* ── Mapa Krajov plugin styles ── */

/* ── Fullscreen map page layout ── */
body.page-template-page-blank-map {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #f0f2f5 !important;
}

body.page-template-page-blank-map #mapa-okresov-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
}

body.admin-bar.page-template-page-blank-map #mapa-okresov-wrap {
    top: 32px;
}

#mapa-okresov-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── SVG map ── */
#mapa-okresov-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

#mapa-okresov-container svg {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 3rem);
    width: auto;
    height: auto;
}

body.admin-bar #mapa-okresov-container svg {
    max-height: calc(100vh - 3rem - 32px);
}

#mapa-okresov-container .district {
    fill: #0097a7;
    stroke: #ffffff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.15s ease;
}

#mapa-okresov-container .district:hover {
    fill: #e040a0;
}

#mapa-okresov-container .district.active {
    fill: #cc0077;
}

/* ── Tooltip ── */
#mapa-okresov-tooltip {
    position: fixed;
    z-index: 9997;
    background: rgba(20, 20, 20, 0.85);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.375rem 0.625rem;
    border-radius: 0.25rem;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 0.125rem 0.375rem rgba(0,0,0,0.25);
    transition: opacity 0.1s;
}

#mapa-okresov-tooltip[hidden] {
    display: none;
}

/* ── Overlay ── */
#mapa-okresov-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 40, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    transition: opacity 0.2s;
}

#mapa-okresov-overlay[hidden],
#mapa-okresov-popup[hidden] {
    display: none;
}

/* ── Popup ── */
#mapa-okresov-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: min(48rem, 92vw);
    max-height: 82vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0,0,0,0.06);
    outline: none;
    animation: mapa-popup-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
    scrollbar-color: #0097a7 transparent;
}

#mapa-okresov-popup::-webkit-scrollbar {
    width: 0.4rem;
}

#mapa-okresov-popup::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 0;
}

#mapa-okresov-popup::-webkit-scrollbar-thumb {
    background: #0097a7;
    border-radius: 0;
}

#mapa-okresov-popup::-webkit-scrollbar-thumb:hover {
    background: #00788a;
}

@keyframes mapa-popup-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#mapa-okresov-popup-inner {
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ── Popup header ── */
#mapa-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1rem 1.1rem 1.5rem;
    background: linear-gradient(135deg, #0097a7 0%, #00535c 100%);
    border-radius: 1rem 1rem 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

#mapa-popup-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
    flex: 1;
}

/* ── Close button ── */
#mapa-okresov-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
    padding: 0;
}

#mapa-okresov-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Popup body ── */
#mapa-popup-thumbnail {
    margin: 0;
    flex-shrink: 0;
}

#mapa-popup-thumbnail img {
    max-width: 100%;
    width: 100%;
    height: 10rem;
    object-fit: cover;
    display: block;
}

#mapa-popup-content {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

#mapa-popup-content p:last-child {
    margin-bottom: 0;
}

/* ── Table ── */
#mapa-popup-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

#mapa-popup-content table th,
#mapa-popup-content table td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e8e8e8;
}

#mapa-popup-content table th {
    width: 40%;
    font-weight: 700;
    color: #ffffff;
    background: #0097a7;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

#mapa-popup-content table td {
    color: #1a1a1a;
}

#mapa-popup-content table tr:last-child th,
#mapa-popup-content table tr:last-child td {
    border-bottom: none;
}

#mapa-popup-content table tr:nth-child(even) td {
    background: #eef1f7;
}

#mapa-popup-content table tr:hover td {
    background: #dde6ff;
}

.mapa-loading {
    color: #888;
    font-style: italic;
    padding: 1rem 1.5rem;
    display: block;
}

#mapa-popup-edit {
    padding: 0 1.5rem 1.25rem;
}

.mapa-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #0097a7 0%, #00535c 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 151, 167, 0.35);
    transition: box-shadow 0.2s, opacity 0.2s;
}
.mapa-edit-link:hover {
    opacity: 0.85;
    color: #fff;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 151, 167, 0.5);
}

/* ── Embedded login form (wp_login_form on frontend) ── */
.login-wrap {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 22rem;
    box-sizing: border-box;
}

#loginform {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#loginform p {
    margin: 0;
}

#loginform label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
    margin-bottom: 0.375rem;
}

#loginform input[type="text"],
#loginform input[type="password"] {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d0d7de;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    background: #fafbfc;
    color: #1a1a1a;
    box-sizing: border-box;
    box-shadow: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: auto;
}

#loginform input[type="text"]:focus,
#loginform input[type="password"]:focus {
    border-color: #0097a7;
    box-shadow: 0 0 0 0.1875rem rgba(0, 151, 167, 0.2);
    background: #ffffff;
    outline: none;
}

#loginform .forgetmenot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #555;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    margin: 0;
}

#loginform .forgetmenot label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 0.875rem;
    color: #555;
    margin: 0;
}

#loginform input[type="submit"],
#loginform .button-primary {
    width: 100%;
    background: #0097a7;
    border: none;
    border-radius: 0.375rem;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.75rem 1rem;
    cursor: pointer;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 151, 167, 0.35);
    transition: background 0.2s, box-shadow 0.2s;
    height: auto;
    text-shadow: none;
}

#loginform input[type="submit"]:hover,
#loginform .button-primary:hover {
    background: #00788a;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 151, 167, 0.45);
}

.login-wrap > p {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.login-wrap > p a {
    color: #0097a7;
    text-decoration: none;
}

.login-wrap > p a:hover {
    color: #cc0077;
    text-decoration: underline;
}

/* ── Inline panel mode ─────────────────────────────────────────────────── */

/* Hide popup/overlay when inline mode is active */
#mapa-okresov-wrap[data-display="inline"] #mapa-okresov-popup,
#mapa-okresov-wrap[data-display="inline"] #mapa-okresov-overlay {
    display: none !important;
}

/* Hide panel when popup mode is active */
#mapa-okresov-wrap[data-display="popup"] #mapa-okresov-panel {
    display: none !important;
}

/* Wrap layout in inline mode — full width, no gaps eating into % */
#mapa-okresov-wrap[data-display="inline"] {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

body.page-template-page-blank-map #mapa-okresov-wrap[data-display="inline"] {
    position: fixed;
    inset: 0;
    top: 0;
    padding: 0;
}

body.admin-bar.page-template-page-blank-map #mapa-okresov-wrap[data-display="inline"] {
    top: 32px;
}

/* Map container — 70% of total width */
#mapa-okresov-wrap[data-display="inline"] #mapa-okresov-container {
    flex: 0 0 70%;
    width: 70%;
    max-width: 70%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    align-self: center;
}

/* Panel — 30% of total width */
#mapa-okresov-wrap[data-display="inline"] #mapa-okresov-panel {
    flex: 0 0 30%;
    width: 30%;
    max-width: 30%;
    min-width: 0;
    position: relative;
    top: auto;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    box-shadow: -2px 0 16px rgba(0,0,0,0.08);
}

/* ── Inline panel ── */
#mapa-okresov-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
    scrollbar-width: thin;
    scrollbar-color: #0097a7 transparent;
}

/* Panel outside inline wrap (non-fullscreen pages) — give it card look */
#mapa-okresov-wrap:not([data-display="inline"]) #mapa-okresov-panel,
body:not(.page-template-page-blank-map) #mapa-okresov-wrap[data-display="inline"] #mapa-okresov-panel {
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0,0,0,0.05);
    max-height: calc(100vh - 3rem);
    position: sticky;
    top: 1rem;
    align-self: flex-start;
}

body.admin-bar:not(.page-template-page-blank-map) #mapa-okresov-panel {
    max-height: calc(100vh - 3rem - 32px);
    top: calc(1rem + 32px);
}

#mapa-okresov-panel::-webkit-scrollbar { width: 0.4rem; }
#mapa-okresov-panel::-webkit-scrollbar-track { background: transparent; }
#mapa-okresov-panel::-webkit-scrollbar-thumb { background: #0097a7; border-radius: 0; }
#mapa-okresov-panel::-webkit-scrollbar-thumb:hover { background: #00788a; }

#mapa-okresov-panel[hidden] {
    display: none;
}

#mapa-panel-header {
    display: flex;
    align-items: center;
    padding: 1.1rem 1.5rem;
    background: linear-gradient(135deg, #0097a7 0%, #00535c 100%);
    border-radius: 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

#mapa-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
}

#mapa-panel-thumbnail img {
    max-width: 100%;
    width: 100%;
    height: 10rem;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

#mapa-panel-content {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
    flex: 1 1 auto;
}

#mapa-panel-content p:last-child {
    margin-bottom: 0;
}

.mapa-panel-placeholder {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

#mapa-panel-edit {
    padding: 0 1.5rem 1.25rem;
    flex-shrink: 0;
}

/* Shared table styles for both popup and inline panel */
#mapa-panel-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

#mapa-panel-content table th,
#mapa-panel-content table td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e8e8e8;
}

#mapa-panel-content table th {
    width: 40%;
    font-weight: 700;
    color: #ffffff;
    background: #0097a7;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

#mapa-panel-content table td {
    color: #1a1a1a;
}

#mapa-panel-content table tr:last-child th,
#mapa-panel-content table tr:last-child td {
    border-bottom: none;
}

#mapa-panel-content table tr:nth-child(even) td {
    background: #eef1f7;
}

#mapa-panel-content table tr:hover td {
    background: #dde6ff;
}
