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

body {
    font-family: 'Inter', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    color: #334155;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.main-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .2);
}

.header-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.add-room-btn {
    background: #10b981;
    color: #fff;
    border: none;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
}

.add-room-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(16, 185, 129, .3);
}

/* Room Card */
.room-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06), 0 4px 12px rgba(0, 0, 0, .04);
    border: 1px solid #e2e8f0;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid #f1f5f9;
}

.room-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

.room-actions {
    display: flex;
    gap: .35rem;
}

/* Action Buttons */
.action-btn {
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
}

.btn-generate {
    background: #10b981;
    color: #fff;
}

.btn-print-map {
    background: #0ea5e9;
    color: #fff;
}

.btn-print-no {
    background: #3b82f6;
    color: #fff;
}

.btn-delete {
    background: #ef4444;
    color: #fff;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

/* Config Form */
.config-section {
    margin-bottom: .75rem;
}

.config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
}

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

.config-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: .7rem;
    font-weight: 600;
    margin-bottom: .25rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-input,
.form-select {
    padding: .5rem .6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .8rem;
    transition: border-color .2s;
    background: #fff;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

/* Gender Config Groups */
.gender-configs {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-top: .6rem;
}

.gender-config {
    padding: .65rem .75rem;
    border-radius: 8px;
    border: 2px solid;
}

.gender-config.lk-config {
    border-color: #86efac;
    background: #f0fdf4;
}

.gender-config.pr-config {
    border-color: #f9a8d4;
    background: #fdf2f8;
}

.gender-config-header {
    font-weight: 700;
    font-size: .8rem;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.gender-config .config-row {
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
}

/* Stats */
.room-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .5rem;
    margin: .75rem 0;
    padding: .6rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.stat-item {
    text-align: center;
    padding: .3rem 0;
}

.stat-label {
    font-size: .6rem;
    color: #94a3b8;
    margin-bottom: .15rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 600;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: center;
    margin: .6rem 0;
    padding: .5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 500;
    color: #475569;
}

.legend-seat {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 2px solid;
}

/* Seat Grid Container */
.seat-grid-container {
    margin-top: .75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    min-height: 120px;
    border: 1px solid #e2e8f0;
    transition: all .3s ease;
}

.seat-grid-container.landscape-preview {
    border: 2px solid #0ea5e9;
    background: #f0f9ff;
    min-height: 200px;
}

.seat-grid-container.landscape-preview::before {
    content: '📐 Landscape Preview';
    display: block;
    font-size: .7rem;
    font-weight: 700;
    color: #0ea5e9;
    margin-bottom: .5rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.seat-grid-placeholder {
    text-align: center;
    color: #94a3b8;
    padding: 1.5rem;
}

.seat-grid-placeholder i {
    font-size: 1.75rem;
    margin-bottom: .4rem;
    display: block;
}

.seat-grid-placeholder p {
    font-size: .8rem;
}

/* Section Layout */
.section-container {
    display: flex;
    gap: 8px;
}

.section-container.layout-vertical {
    flex-direction: column;
}

.section-container.layout-horizontal {
    flex-direction: row;
    align-items: flex-start;
}

.stage-indicator {
    text-align: center;
    padding: .35rem .75rem;
    background: linear-gradient(135deg, #334155, #475569);
    color: #fff;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.gender-section {
    width: 100%;
}

.section-label {
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 4px;
    margin-bottom: 3px;
    display: inline-block;
}

.laki-laki-section .section-label {
    background: #dcfce7;
    color: #166534;
}

.perempuan-section .section-label {
    background: #fce7f3;
    color: #9d174d;
}

.section-separator {}

.layout-vertical .section-separator {
    height: 2px;
    background: linear-gradient(90deg, #22c55e, #94a3b8, #ec4899);
    border-radius: 2px;
    margin: 6px 0;
}

.layout-horizontal .section-separator {
    width: 2px;
    background: linear-gradient(180deg, #22c55e, #94a3b8, #ec4899);
    border-radius: 2px;
    align-self: stretch;
}

/* Seat Grid */
.seat-grid {
    display: grid;
    row-gap: 4px;
    /* Jarak atas-bawah antar kursi di denah */
    column-gap: 1px;
    /* Jarak kiri-kanan antar kursi di denah */
    width: 100%;
}

/* Seat */
.seat {
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    font-weight: 700;
    border: 2px solid;
    cursor: default;
    transition: all .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.seat:hover {
    transform: scale(1.08);
    z-index: 1;
}

.seat.laki-laki {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.seat.perempuan {
    background: #fce7f3;
    border-color: #ec4899;
    color: #9d174d;
}

.seat.vip {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.seat.kosong {
    background: #fef9c3;
    border-color: #eab308;
    color: #854d0e;
}

/* Print: No Kursi cards hidden by default */
.print-page-no-kursi {
    display: none;
}

/* ===== PRINT STYLES ===== */
@media print {
    @page {
        size: A4;
        margin: 1cm;
    }

    body {
        background: #fff !important;
    }

    .no-print {
        display: none !important;
    }

    /* Map print mode */
    .print-map-area {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .print-map-area .seat-grid-container {
        background: #fff !important;
        border: 1px solid #ccc !important;
        padding: 5mm !important;
        margin: 0 !important;
        min-height: auto !important;
    }

    .print-map-area .seat-grid {
        gap: 2px !important;
    }

    .print-map-area .seat {
        width: 22px !important;
        height: 22px !important;
        font-size: 5pt !important;
        border-width: 1px !important;
    }

    .room-card:not(.print-map-area) {
        break-inside: avoid;
        margin-bottom: 5mm;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        padding: 5mm;
    }

    .config-section,
    .gender-configs,
    .legend,
    .room-actions .btn-delete,
    .room-actions .btn-generate,
    .room-stats,
    .main-header,
    .room-card:not(.print-map-area) .seat-grid-container {
        display: none !important;
    }

    .room-card.print-map-area .room-header,
    .room-card.print-map-area .room-actions,
    .room-card.print-map-area .config-section,
    .room-card.print-map-area .gender-configs,
    .room-card.print-map-area .legend,
    .room-card.print-map-area .room-stats {
        display: none !important;
    }

    /* No Kursi print mode */
    .print-page-no-kursi {
        display: block !important;
    }

    .print-page-no-kursi .print-page {
        page-break-after: always;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 2mm;
        height: 265mm;
        width: 100%;
    }

    .print-page-no-kursi .print-page:last-child {
        page-break-after: auto;
    }

    .print-page-no-kursi .print-seat-card {
        padding: 4mm;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        overflow: hidden;
        line-height: 1.4;
        background: #fff !important;
        color: #000 !important;
        border-width: 2.5px;
        border-style: solid;
        border-radius: 6px;
    }

    .print-seat-card.laki-laki-card {
        border-color: #22c55e;
    }

    .print-seat-card.perempuan-card {
        border-color: #ec4899;
    }

    .print-seat-card.kosong-card {
        border-color: #eab308;
    }

    .print-seat-card.vip-card {
        border-color: #f59e0b;
    }

    .print-seat-card .room-name {
        font-weight: 700;
        font-size: 11pt;
        margin-bottom: 2mm;
    }

    .print-seat-card .seat-label {
        font-weight: 800;
        font-size: 70pt;
        margin: 2mm 0;
    }

    .print-seat-card .gender-info {
        font-size: 10pt;
        color: #555;
    }
}

/* Responsive */
@media (max-width:640px) {
    .main-header {
        flex-direction: column;
        gap: .6rem;
        text-align: center;
    }

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

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

    .room-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .legend {
        gap: .5rem;
    }
}