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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-width: 320px;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-width: 320px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-picker label {
    font-weight: 500;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 5px;
}

.date-nav-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.date-nav-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.date-nav-btn:active {
    transform: scale(0.95);
}

#booking-date {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.admin-btn {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

#admin-logout-btn {
    background: #e74c3c;
}

#admin-logout-btn:hover {
    background: #c0392b;
}

main {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.seat-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #ddd;
}

/* Touch-friendly sizes for mobile */
@media (pointer: coarse) {
    .btn, .admin-btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .date-nav-btn {
        width: 44px;
        height: 44px;
    }
    
    #booking-date {
        min-height: 44px;
    }
    
    .form-group select,
    .form-group input {
        min-height: 44px;
    }
}

.seat-icon.available {
    background: #2ecc71;
}

.seat-icon.booked {
    background: #e74c3c;
}

.seat-icon.selected {
    background: #f39c12;
}

.floor-plan {
    width: 100%;
    height: 650px;
    max-height: 80vh;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    overflow: auto;
    position: relative;
}

.floor-plan svg {
    min-width: 1200px;
    min-height: 600px;
    width: auto;
    height: auto;
}

.seat {
    cursor: pointer;
    transition: opacity 0.2s;
}

.seat:hover {
    opacity: 0.8;
}

.seat.available {
    fill: #2ecc71;
}

.seat.booked {
    fill: #e74c3c;
    cursor: default;
}

.seat.selected {
    fill: #f39c12;
}

.meeting-room {
    fill: #3498db;
    opacity: 0.3;
    stroke: #2980b9;
    stroke-width: 2;
}

.meeting-room.booked {
    fill: #e74c3c;
    opacity: 0.5;
}

.seat-label {
    font-size: 10px;
    fill: white;
    pointer-events: none;
    user-select: none;
}

.user-name-label {
    font-size: 10px;
    fill: #2c3e50;
    pointer-events: none;
    user-select: none;
    font-weight: 600;
}

.room-label {
    font-size: 14px;
    font-weight: bold;
    fill: #2c3e50;
}

.booking-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-content.modal-wide {
    max-width: 1200px;
    margin: 2% auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

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

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

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.btn-primary {
    background: #2ecc71;
    color: white;
}

.btn-primary:hover {
    background: #27ae60;
}

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

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

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

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

.admin-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.admin-section:last-child {
    border-bottom: none;
}

.admin-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

#users-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

#users-list li {
    padding: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#users-list li:last-child {
    border-bottom: none;
}

.delete-user-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.delete-user-btn:hover {
    background: #c0392b;
}

/* Floor Plan Editor */
.editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.editor-toolbar .btn {
    flex: 0 0 auto;
}

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

.btn-success:hover {
    background: #229954;
}

.editor-info {
    margin-left: auto;
    font-size: 12px;
    color: #666;
}

.editor-floor-plan {
    width: 100%;
    height: 600px;
    background: #fafafa;
    border: 2px solid #3498db;
    border-radius: 4px;
    padding: 20px;
    overflow: auto;
    position: relative;
}

.editor-floor-plan svg {
    width: 100%;
    height: 100%;
    cursor: default;
}

.editor-floor-plan .seat {
    cursor: move;
}

.editor-floor-plan .seat.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.editor-floor-plan .seat.delete-mode {
    cursor: crosshair;
}

.editor-floor-plan .seat.delete-mode:hover {
    fill: #e74c3c !important;
    opacity: 0.7;
}

.grid-line {
    stroke: #ddd;
    stroke-width: 0.5;
    opacity: 0.5;
}

.delete-mode-active .seat {
    cursor: crosshair;
}

.delete-mode-active .seat:hover {
    fill: #e74c3c !important;
}

.admin-hint {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .floor-plan {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .date-picker {
        width: 100%;
    }
    
    .date-navigation {
        justify-content: center;
        width: 100%;
    }
    
    #booking-date {
        flex: 1;
    }
    
    .admin-btn {
        width: 100%;
        text-align: center;
    }
    
    .legend {
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }
    
    .floor-plan {
        height: 400px;
        padding: 5px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 15px;
    }
    
    .modal-content.modal-wide {
        margin: 5% auto;
    }
    
    .editor-toolbar {
        padding: 10px;
    }
    
    .editor-toolbar .btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
    }
    
    .editor-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .editor-floor-plan {
        height: 400px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2rem;
    }
    
    .floor-plan {
        height: 350px;
    }
    
    .legend {
        font-size: 14px;
    }
    
    .legend-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .seat-icon {
        width: 20px;
        height: 20px;
    }
    
    .modal-content {
        margin: 5% auto;
    }
    
    .editor-toolbar .btn {
        flex: 1 1 100%;
        font-size: 13px;
    }
}