/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow: hidden;
}

.container {
    text-align: center;
    max-width: 1200px;
    width: 100%;
    padding: 20px;
}

h1 {
    color: white;
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.left-buttons {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
    flex-wrap: wrap;
}

.right-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
    flex-wrap: wrap;
}

.top-btn {
    border: none;
    color: white;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.start-button {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
}

.save-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.toggle-sidebar-button {
    background: linear-gradient(45deg, #11998e, #38ef7d);
}

.download-button {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

.print-button {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
}

.top-btn:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.top-btn:active {
    transform: translateY(0);
}

.top-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.seating-plan {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;           /* Fit entirely, preserve aspect */
    object-position: center center;/* Center the image in both axes */
    pointer-events: none;
    z-index: 1;
}

.seat {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    z-index: 10; /* Above background image */
    pointer-events: none;
}

.label.animating {
    animation: pulse 0.1s infinite alternate;
}

.label.final {
    color: #006400;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
    font-weight: bold;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes slotMachine {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.label.stopping {
    animation: slotMachine 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .start-button {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .seating-plan {
        padding-bottom: 100%; /* Taller for mobile */
    }

    .seat {
        font-size: 12px;
        min-width: 60px;
        min-height: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .start-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .seat {
        font-size: 10px;
        min-width: 50px;
        min-height: 25px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .seat.animating,
    .seat.stopping {
        animation: none;
    }

    .start-button {
        transition: none;
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.sidebar-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.close-sidebar:hover {
    color: #333;
}

.layouts-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.layout-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.layout-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.layout-item.active {
    border-color: #4ECDC4;
    background: #e8f5f3;
}

.layout-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layout-item h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1rem;
}

.layout-item .date {
    font-size: 0.8rem;
    color: #666;
}

.delete-layout {
    background: #dc3545;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-layout:hover {
    background: #c82333;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
}

.modal-content input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.cancel {
    background: #e9ecef;
    color: #333;
}

.modal-btn.confirm {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

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

.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

.error-message.visible {
    display: block;
}

.no-layouts {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Mobile responsive for buttons and sidebar */
@media (max-width: 768px) {
    .top-buttons {
        flex-wrap: wrap;
        gap: 5px;
        right: 10px;
        top: 10px;
    }
    
    .start-button, .save-button, .toggle-sidebar-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
}