/**
 * Hlavni styly pro Ples OAVM - Mapa mist
 */

/* Reset a zaklad */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
}

/* Layout */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

header h1 {
    font-size: 1.5rem;
    color: #2c3e50;
}

header nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

header nav a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

header nav a:hover {
    text-decoration: underline;
}

header nav span {
    color: #7f8c8d;
    font-size: 0.9rem;
}

main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

footer {
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Tlacitka */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Formular */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

/* Grid map */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.map-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.map-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.map-card a {
    text-decoration: none;
    color: inherit;
}

.map-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #e0e0e0;
}

.map-card h3 {
    padding: 15px 15px 5px;
    font-size: 1.2rem;
    color: #2c3e50;
}

.map-card p.stats {
    padding: 0 15px 10px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.map-card .btn {
    margin: 0 15px 15px;
}

/* Login stranka */
.login-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 25px;
    color: #2c3e50;
}

.error {
    background: #fdeaea;
    color: #c0392b;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #e74c3c;
}

.text-center {
    text-align: center;
    margin-top: 15px;
}

/* Mapa - kontejner */
.map-container {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.zoom-btn:hover {
    background: #f0f0f0;
}

.zoom-btn:active {
    transform: scale(0.95);
    background: #e0e0e0;
}

.zoom-btn.zoom-reset {
    font-size: 1.3rem;
}

/* Zoom hint */
.zoom-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.5s;
}

.zoom-hint.hidden {
    opacity: 0;
}

/* Map viewport - oblast pro zoom */
.map-viewport {
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.map-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    transform-origin: center center;
    will-change: transform;
}

.map-wrapper img.map-image {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
}

.pins-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Piny na mape */
.seat-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
}

.seat-pin .pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.seat-pin.reserved .pin-dot {
    background: #27ae60;
}

.seat-pin.empty .pin-dot {
    background: #e74c3c;
}

.seat-pin:hover .pin-dot,
.seat-pin.active .pin-dot {
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.seat-pin.editable {
    cursor: pointer;
}

/* Tooltip */
.pin-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    white-space: nowrap;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 49999;
}

.pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
    z-index: 49999;

}

.seat-pin:hover .pin-tooltip,
.seat-pin.active .pin-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Legenda */
.legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.legend-item .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.legend-item .dot.green {
    background: #27ae60;
}

.legend-item .dot.red {
    background: #e74c3c;
}

/* Editor - specificke styly */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mode-indicator {
    color: #7f8c8d;
    font-style: italic;
}

.mode-indicator.active {
    color: #e67e22;
    font-weight: 500;
}

.editor-toolbar .stats {
    margin-left: auto;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.editor-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.editor-wrapper .map-container {
    flex: 1;
    min-width: 0;
}

.seat-panel {
    width: 320px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
}

.seat-panel.active {
    display: block;
}

.seat-panel h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Responzivita */
@media (max-width: 900px) {
    .editor-wrapper {
        flex-direction: column;
    }

    .seat-panel {
        width: 100%;
        order: -1;
    }

    header {
        flex-direction: column;
        gap: 10px;
    }

    header nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    main {
        padding: 10px;
    }

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

    .login-container {
        margin: 20px;
        padding: 20px;
    }

    .editor-toolbar {
        flex-wrap: wrap;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    /* Zoom tlacitka na mobilu */
    .zoom-controls {
        top: 10px;
        right: 10px;
    }

    .zoom-btn {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
    }

    /* Hint na mobilu */
    .zoom-hint {
        font-size: 0.8rem;
        padding: 8px 16px;
        bottom: 10px;
    }

    /* Tooltip na mobilu - vetsi a lepe citelny */
    .pin-tooltip {
        font-size: 1rem;
        padding: 10px 14px;
        max-width: 200px;
        white-space: normal;
        z-index: 49999;
    }

    /* Legenda na mobilu */
    .legend {
        padding: 12px;
        gap: 15px;
    }

    header h1 {
        font-size: 1.2rem;
    }
}

/* Rotate overlay - pouze na mobilu v portrait modu */
.rotate-overlay {
    display: none;
}

@media screen and (max-width: 900px) and (orientation: portrait) {
    .rotate-overlay {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
        z-index: 99999;
        align-items: center;
        justify-content: center;
        text-align: center;
        color: #fff;
    }

    .rotate-content {
        padding: 40px;
        max-width: 320px;
    }

    .rotate-icon {
        font-size: 80px;
        margin-bottom: 20px;
        animation: rotate-phone 1s ease-in-out infinite;
    }

    @keyframes rotate-phone {
        0%, 100% { transform: rotate(0deg); }
        5% { transform: rotate(-10deg); }
        20%, 50% { transform: rotate(90deg); }
    }

    .rotate-content h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
        font-weight: 600;
    }

    .rotate-content p {
        font-size: 1rem;
        opacity: 0.8;
        line-height: 1.5;
    }
}
