/* Slide-specific CSS variables */
:root {
    --table-seat-size: 50px;
    --table-bg-color: #8B4513;
    --seat-empty-color: #e8e8e8;
    --seat-filled-color: linear-gradient(135deg, #667eea, #764ba2);
}

.sidebar h1 {
    font-size: 1.125rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: left;
}

.section-header {
    font-size: 0.73125rem;
    font-weight: 700;
    color: #3479FF;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    padding-left: 2px;
}

/* Class Selector */
.class-selector-section {
    display: flex;
    flex-direction: column;
}

.class-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.class-dropdown-container {
    position: relative;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.class-dropdown-btn {
    width: 100%;
    padding: 7px 12px 7px 8px;
    background: #fafafa;
    color: #333;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 0.7125rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    height: 36px;
    text-align: left;
}

.class-dropdown-btn .dropdown-icon {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    color: #667eea;
}

.class-dropdown-btn.dropdown-open .dropdown-icon {
    transform: rotate(180deg);
}

.class-dropdown-btn:hover {
    background: #fff;
    border-color: #3479FF;
}

.class-dropdown-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.class-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    max-height: 390px;
    overflow-y: auto;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.class-dropdown-menu.show {
    display: flex;
}

.class-option {
    padding: 8px 12px 8px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.7125rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 36px;
    line-height: 20px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.class-option:hover {
    background: #f5f5f5;
}

.class-option:active {
    background: #e8e8e8;
}

.class-option.create-new-option {
    color: #3479FF;
    font-weight: 700;
}

.class-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: #fafafa;
    font-size: 0.825rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.class-btn:hover {
    border-color: #3479FF;
    background: #f0f4ff;
}

.delete-class-btn {
    font-size: 0.675rem;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.delete-class-btn:hover {
    border-color: #e74c3c;
    background: #fef2f2;
}

.delete-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.class-name-input {
    margin-top: 10px;
    padding: 7px 8px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 0.7125rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #333;
}

.class-name-input:focus {
    outline: none;
    border-color: #3479FF;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.class-dropdown-btn .class-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.class-dropdown-btn.loading {
    color: #999;
}

.class-dropdown-btn.loading .dropdown-icon {
    animation: spin-icon 0.8s linear infinite;
}

@keyframes spin-icon {
    to {
        transform: rotate(360deg);
    }
}

/* Add Students */
.bulk-section {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}

.bulk-textarea {
    width: 100%;
    min-height: 82px;
    padding: 8px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 0.7125rem;
    font-family: 'Poppins', sans-serif;
    resize: vertical;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #333;
}

.bulk-textarea:focus {
    outline: none;
    border-color: #3479FF;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.bulk-textarea::placeholder {
    color: #aaa;
}

.bulk-add-btn {
    margin-top: 10px;
    padding: 9px 14px;
    background: #3379FF;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.675rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bulk-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(51, 121, 255, 0.4);
}

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

/* Student List */
.student-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.student-item.hidden {
    background: rgba(248, 249, 250, 0.5);
    border-color: transparent;
}

.student-item.hidden .student-name {
    text-decoration: line-through;
    text-decoration-color: #999;
    text-decoration-thickness: 2px;
    opacity: 0.6;
    color: #999;
}

.student-item.hidden:hover {
    background: #E8E8E8;
    border-color: #CCCCCC;
}

/* Keep buttons and tooltips at full opacity even when student is hidden */
.student-item.hidden .student-item-actions {
    opacity: 1;
}


.student-item-actions {
    position: relative;
    overflow: visible;
    display: flex;
    gap: 4px;
    align-items: center;
}

.hide-show-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hide-show-btn:hover {
    color: #666;
    background: rgba(0, 0, 0, 0.05);
}

.hide-show-btn .hide-icon {
    width: 11.2px;
    height: 11.2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hide-show-btn .hide-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.student-item.hidden .hide-icon img {
    filter: grayscale(100%) brightness(0.7);
    opacity: 0.8;
}

.student-list-header {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
}

.student-filter-toggle {
    display: flex;
    width: 100%;
    gap: 4px;
    background: #f5f5f5;
    padding: 2px;
    border-radius: 8px;
}

.filter-toggle-btn {
    font-size: 0.6rem;
    font-weight: 600;
    color: #999;
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    flex: 1;
}

.filter-toggle-btn:hover {
    color: #3479FF;
    background: rgba(102, 126, 234, 0.1);
}

.filter-toggle-btn.active {
    color: #3479FF;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.filter-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: #DDDDDD;
    color: #656565;
    font-size: 0.55rem;
    font-weight: 600;
    margin-left: 2px;
    line-height: 1;
}

.filter-toggle-btn.active .filter-toggle-count {
    background: #DDDDDD;
    color: #656565;
}

.student-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 0;
}

.student-list::-webkit-scrollbar {
    width: 5px;
}

.student-list::-webkit-scrollbar-track {
    background: transparent;
}

.student-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.student-list::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.students-placeholder-image {
    width: 40%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: auto;
}

.student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 10px;
    animation: slideIn 0.3s ease;
    border: 1.56px solid #e0e7ff;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.student-item:hover {
    background: #f0f4ff;
    border-color: #e0e7ff;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.student-name {
    font-weight: 600;
    color: #333;
    font-size: 0.7125rem;
    cursor: text;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 4px;
    outline: none;
    transition: background 0.2s ease;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    width: fit-content;
    overflow-wrap: break-word;
    word-break: break-word;
}

.student-name:hover {
    background: rgba(52, 121, 255, 0.1);
}

.student-name:focus {
    background: #fff;
    box-shadow: 0 0 0 2px #3479FF;
}

.remove-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.remove-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.remove-btn .remove-icon {
    font-size: 0.825rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Generate Button (Assign Tables) */
.generate-btn {
    padding: 12px 18px;
    background: linear-gradient(135deg, #832EC5 0%, #B900FF 50%, #FFC700 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(131, 46, 197, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(131, 46, 197, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(131, 46, 197, 0.3);
}

.generate-btn .shuffle-icon {
    width: 1.2rem;
    height: 1.2rem;
    transition: transform 0.6s ease;
    display: inline-block;
    object-fit: contain;
}

.generate-btn:hover .shuffle-icon {
    transform: rotateX(360deg) rotateY(360deg);
}

/* Controls Wrapper */
.controls-wrapper {
    position: relative;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 11px;
    width: 100%;
}

.top-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.restart-btn {
    padding: 10px 20px;
    background: white;
    color: #333;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.2;
    height: 46px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: none;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.restart-btn .restart-emoji {
    width: 0.84rem;
    height: 0.84rem;
    display: block;
}

.restart-btn .restart-text {
    margin-left: 6px;
}

.restart-btn.show {
    display: flex;
}

.restart-btn:hover {
    background: #f5f5f5;
    border: 2px solid #832DC5;
    box-shadow: none;
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.empty-state.visible {
    display: flex;
    opacity: 1;
}

.empty-state .icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.empty-state h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 360px;
    line-height: 1.6;
}

/* ==================== TABLE CANVAS ==================== */
.table-canvas-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
    overflow: hidden;
}

.table-canvas {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    overflow: visible; /* Allow resize handles to extend outside */
    transform-origin: center center;
}

/* Resize handles - attached to the classroom canvas edges */
.resize-handle {
    position: absolute;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.resize-handle-left,
.resize-handle-right {
    top: 0;
    bottom: 0;
    width: 20px;
    cursor: ew-resize;
}

.resize-handle-top,
.resize-handle-bottom {
    left: 0;
    right: 0;
    height: 20px;
    cursor: ns-resize;
}

.resize-handle-left .resize-handle-grip,
.resize-handle-right .resize-handle-grip {
    width: 6px;
    height: 60px;
    max-height: 40%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.resize-handle-top .resize-handle-grip,
.resize-handle-bottom .resize-handle-grip {
    height: 6px;
    width: 60px;
    max-width: 40%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.resize-handle-grip::before,
.resize-handle-grip::after {
    content: '';
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
}

.resize-handle-left:hover .resize-handle-grip,
.resize-handle-left.active .resize-handle-grip,
.resize-handle-right:hover .resize-handle-grip,
.resize-handle-right.active .resize-handle-grip {
    background: rgba(255, 255, 255, 0.9);
    height: 80px;
    max-height: 50%;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.resize-handle-top:hover .resize-handle-grip,
.resize-handle-top.active .resize-handle-grip,
.resize-handle-bottom:hover .resize-handle-grip,
.resize-handle-bottom.active .resize-handle-grip {
    background: rgba(255, 255, 255, 0.9);
    width: 80px;
    max-width: 50%;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.resize-handle:hover .resize-handle-grip::before,
.resize-handle:hover .resize-handle-grip::after,
.resize-handle.active .resize-handle-grip::before,
.resize-handle.active .resize-handle-grip::after {
    background: white;
}

.resize-handle-left {
    left: -10px;
    border-radius: 10px 0 0 10px;
}

.resize-handle-right {
    right: -10px;
    border-radius: 0 10px 10px 0;
}

.resize-handle-top {
    top: -10px;
    border-radius: 10px 10px 0 0;
}

.resize-handle-bottom {
    bottom: -10px;
    border-radius: 0 0 10px 10px;
}

.resize-handle-left:hover,
.resize-handle-left.active,
.resize-handle-right:hover,
.resize-handle-right.active,
.resize-handle-top:hover,
.resize-handle-top.active,
.resize-handle-bottom:hover,
.resize-handle-bottom.active {
    background: rgba(255, 255, 255, 0.15);
}

/* Dimension indicator */
.dimension-indicator {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    opacity: 1;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 150;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dimension-indicator.resizing {
    background: rgba(131, 46, 197, 0.8);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(131, 46, 197, 0.5);
}

/* ==================== TABLE CREATOR BAR ==================== */
.table-creator-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    flex-wrap: wrap;
}

.table-creator-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.creator-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
}

.shape-selector {
    display: flex;
    gap: 8px;
}

.shape-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: #fafafa;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shape-btn:hover {
    border-color: #3479FF;
    color: #3479FF;
    background: #f0f4ff;
}

.shape-btn.active {
    border-color: #832EC5;
    background: #f5e8ff;
    color: #832EC5;
}

.shape-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.size-stepper {
    display: flex;
    align-items: center;
    background: #F5F5F5;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.stepper-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    color: #3479FF;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn:hover {
    background: #E8E8E8;
}

.stepper-btn:active {
    background: #DDDDDD;
}

.stepper-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: transparent;
}

.stepper-value {
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    background: #fff;
    border-left: 2px solid #e5e7eb;
    border-right: 2px solid #e5e7eb;
}

.add-table-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #832EC5 0%, #B900FF 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(131, 46, 197, 0.3);
}

.add-table-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(131, 46, 197, 0.4);
}

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

.add-table-btn .add-icon {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Unassigned students indicator */
.unassigned-section {
    border-left: 2px solid #eee;
    padding-left: 24px;
    margin-left: 8px;
}

.unassigned-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fef3cd;
    border-radius: 10px;
    border: 2px solid #ffc107;
    transition: all 0.3s ease;
}

.unassigned-indicator.all-assigned {
    background: #d4edda;
    border-color: #28a745;
}

.unassigned-count {
    font-size: 1.1rem;
    font-weight: 800;
    color: #856404;
    min-width: 24px;
    text-align: center;
}

.unassigned-indicator.all-assigned .unassigned-count {
    color: #155724;
}

.unassigned-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #856404;
    white-space: nowrap;
}

.unassigned-indicator.all-assigned .unassigned-label {
    color: #155724;
}


/* ==================== TABLE STYLES ==================== */
.classroom-table {
    position: absolute;
    cursor: grab;
    transition: box-shadow 0.2s ease, left 0.2s ease, top 0.2s ease;
    z-index: 10;
}

.classroom-table:active {
    cursor: grabbing;
}

.classroom-table.dragging {
    opacity: 0.4;
    z-index: 100;
    cursor: grabbing;
    transition: box-shadow 0.2s ease, opacity 0.2s ease; /* Remove position transition while dragging */
}

.classroom-table:hover {
    z-index: 20;
}

/* Flash animation for newly added tables */
.classroom-table.table-flash .table-shape {
    animation: tableFlash 1s ease-in-out;
}

@keyframes tableFlash {
    0% {
        box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    }
    12.5% {
        box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.9), 0 0 20px rgba(255, 215, 0, 0.6);
    }
    25% {
        box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    }
    37.5% {
        box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.9), 0 0 20px rgba(255, 215, 0, 0.6);
    }
    62.5% {
        box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    }
    100% {
        box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    }
}

/* Table shapes */
.table-shape {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Line table */
.table-shape.line {
    flex-direction: row;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

/* Circle table */
.table-shape.circle {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.table-shape.circle.seats-2 { width: 100px; height: 100px; }
.table-shape.circle.seats-3 { width: 110px; height: 110px; }
.table-shape.circle.seats-4 { width: 120px; height: 120px; }
.table-shape.circle.seats-5 { width: 135px; height: 135px; }
.table-shape.circle.seats-6 { width: 150px; height: 150px; }

/* Square table (2x2 desk grid inside) */
.table-shape.square {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

/* Teacher desk */
.table-shape.teacher-desk {
    width: 160px;
    height: 80px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.teacher-desk-label {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
}

/* ==================== SEAT STYLES ==================== */
.table-seat {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    background: var(--seat-empty-color);
    border: 3px solid #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #999;
    transition: all 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1 / 1;
}

.table-seat.filled {
    background: var(--seat-filled-color);
    border-color: #667eea;
    color: white;
    font-size: 0.65rem;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Seats for line table (square desk blocks) */
.table-shape.line .table-seat {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 4px;
}

/* Seats for circle table (square seats positioned around) */
.table-shape.circle .seats-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.table-shape.circle .table-seat {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 4px;
}

/* Seats for square table (2x2 grid inside the table frame) */
.table-shape.square .seats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.table-shape.square .table-seat {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.table-shape.square .table-seat.top,
.table-shape.square .table-seat.right,
.table-shape.square .table-seat.bottom,
.table-shape.square .table-seat.left {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
}

/* Delete button for tables */
.table-delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 30;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.classroom-table:hover .table-delete-btn {
    display: flex;
}

.table-delete-btn:hover {
    transform: scale(1.1);
    background: #c0392b;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-message {
    flex: 1;
}

/* Confirm Modal Styles */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(4px);
}

.confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.confirm-modal {
    background: white;
    border-radius: 16px;
    padding: 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.confirm-overlay.show .confirm-modal {
    transform: scale(1);
}

.confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #fee;
    border-radius: 50%;
    color: #d32f2f;
}

.confirm-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.confirm-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin: 0;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.confirm-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn-cancel {
    background: #f5f5f5;
    color: #333;
}

.confirm-btn-cancel:hover {
    background: #e8e8e8;
}

.confirm-btn-delete {
    background: #d32f2f;
    color: white;
}

.confirm-btn-delete:hover {
    background: #b71c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .table-creator-bar {
        padding: 12px 16px;
        gap: 16px;
    }

    .table-creator-section {
        gap: 8px;
    }

    .creator-label {
        font-size: 0.75rem;
    }

    .shape-btn {
        width: 38px;
        height: 38px;
    }

    .add-table-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 640px) {
    .table-creator-bar {
        flex-direction: column;
        gap: 12px;
    }

    .table-creator-section {
        width: 100%;
        justify-content: center;
    }

    .unassigned-section {
        border-left: none;
        border-top: 2px solid #eee;
        padding-left: 0;
        padding-top: 12px;
        margin-left: 0;
    }
}

/* Avatar color variations for seated students */
.table-seat.filled:nth-child(6n+1) { background: linear-gradient(135deg, #667eea, #764ba2); }
.table-seat.filled:nth-child(6n+2) { background: linear-gradient(135deg, #f093fb, #f5576c); }
.table-seat.filled:nth-child(6n+3) { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.table-seat.filled:nth-child(6n+4) { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.table-seat.filled:nth-child(6n+5) { background: linear-gradient(135deg, #fa709a, #fee140); }
.table-seat.filled:nth-child(6n+6) { background: linear-gradient(135deg, #a8edea, #fed6e3); color: #555; }
