/* Reset and Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f3f4f6;
    color: #212529;
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* Two-column Layout */
#main-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Left Column: 3D Viewport */
#viewport-column {
    flex: 1;
    position: relative;
    height: 100%;
    background-color: #f3f4f6; /* Matching background in screenshot */
}

#canvas-container {
    width: 100%;
    height: 100%;
}

.main-title {
    position: absolute;
    top: 30px;
    left: 40px;
    font-size: 32px;
    font-weight: 700;
    color: #212529;
    z-index: 10;
}

/* Right Column: Sidebar Controls */
#sidebar {
    width: 350px;
    height: 100%;
    background-color: #f9fafb;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.02);
}

/* Navigation Tabs */
.tabs-container {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 18px 0;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    cursor: pointer;
    text-align: center;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #212529;
    border-bottom-color: #0086b3; /* Teal underline in screenshot */
}

/* Sidebar Scrollable Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Tab Panels */
.tab-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.tab-panel.hidden {
    display: none !important;
}

/* Sidebar Section Headers */
.section-header {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

/* Statistics */
.stats-number {
    font-size: 40px;
    font-weight: 600;
    color: #212529;
    line-height: 1;
}

.stats-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Direction Toggles */
.direction-toggle {
    display: flex;
    background-color: #f3f4f6;
    border-radius: 4px;
    padding: 2px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.toggle-option {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.toggle-option.active {
    background-color: #ffffff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #d1d5db;
}

/* Grid of Moves (U, D, L, R, F, B) */
.moves-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.move-btn {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    font-weight: 600;
    font-size: 16px;
    padding: 16px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.move-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-0.5px);
}

.move-btn:active {
    background-color: #f3f4f6;
    transform: translateY(0.5px);
}

/* Color Picker Palette */
.color-picker-palette {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 4px 0;
}

.palette-color {
    width: 38px;
    height: 38px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transition: all 0.1s ease;
}

.palette-color:hover {
    transform: scale(1.05);
}

.palette-color.active {
    outline: 2px solid #0086b3;
    outline-offset: 2px;
}

/* 2D Rubik Net Unfolded Layout */
.rubik-net {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.net-space {
    visibility: hidden;
}

.net-face {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    aspect-ratio: 1 / 1;
    background-color: #e5e7eb;
    padding: 2px;
    border-radius: 4px;
}

.net-cell {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.net-cell:hover:not(.fixed) {
    background-color: #f3f4f6;
    filter: brightness(0.95);
}

.net-cell.fixed {
    cursor: not-allowed;
    border: 2px solid #9ca3af;
}

/* Solution Moves Badges Box */
.solution-moves-box {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    min-height: 80px;
    max-height: 140px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.move-badge {
    background-color: #f3f4f6;
    color: #374151;
    font-family: monospace;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    transition: all 0.15s ease;
}

.move-badge.active {
    background-color: #0086b3;
    color: #ffffff;
    border-color: #007399;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 134, 179, 0.3);
}

.move-badge.done {
    background-color: #e5e7eb;
    color: #9ca3af;
    border-color: #e5e7eb;
}

/* Action Controls */
.actions-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-sidebar {
    width: 100%;
    padding: 12px 0;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

/* Solid Blue/Teal Scramble button */
.btn-scramble {
    background-color: #0086b3;
    color: #ffffff;
    border: none;
}

.btn-scramble:hover {
    background-color: #007399;
}

.btn-scramble:active {
    background-color: #006080;
}

/* White outlined buttons */
.btn-outline {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.btn-outline:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.btn-outline:active {
    background-color: #f3f4f6;
}

/* Congrats Modal styling */
.congrats-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    text-align: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.congrats-banner.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.congrats-title {
    font-size: 24px;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 8px;
}

.congrats-text {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 20px;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    #main-container {
        flex-direction: column;
    }
    
    #sidebar {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }

    #viewport-column {
        height: 50vh;
    }

    .main-title {
        font-size: 24px;
        top: 20px;
        left: 20px;
    }
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast-msg {
    pointer-events: auto;
    min-width: 240px;
    max-width: 340px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background-color: #1f2937;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-msg.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-msg.success {
    background-color: #10b981;
}

.toast-msg.error {
    background-color: #ef4444;
}

.toast-msg.info {
    background-color: #0086b3;
}
