/* CSS cho FabricJS Processor */
.popup-container {
    background: #f5f5f5;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.window-header {
    background: linear-gradient(to right, #fed7aa, #fdba74);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.window-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-icon {
    width: 24px;
    height: 24px;
    background: #fb923c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 32px;
    height: 32px;
    background: #fed7aa;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-bottom: 0;
}

.control-btn:hover {
    background: #fdba74;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.room-display {
    flex: 1;
    padding: 20px;
    position: relative;
    flex-basis: 60%;
    max-width: 60%;
}

.room-image-container {
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.room-layers {
    width: 100%;
    height: 100%;
    position: relative;
}

.wall-color-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    transition: background-color 0.3s ease;
    z-index: 1;
}

.room-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.wall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    mix-blend-mode: multiply;
}

#roomCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    cursor: move;
}

/* Different wall masks for different room types */
.wall-overlay.living-room {
    background: linear-gradient(135deg,
            transparent 0%,
            transparent 15%,
            currentColor 15%,
            currentColor 45%,
            transparent 45%,
            transparent 55%,
            currentColor 55%,
            currentColor 85%,
            transparent 85%);
}

.wall-overlay.bedroom {
    background: linear-gradient(90deg,
            currentColor 0%,
            currentColor 25%,
            transparent 25%,
            transparent 75%,
            currentColor 75%,
            currentColor 100%);
}

.wall-overlay.kitchen {
    background: linear-gradient(180deg,
            currentColor 0%,
            currentColor 40%,
            transparent 40%,
            transparent 100%);
}

.wall-overlay.bathroom {
    background: linear-gradient(45deg,
            currentColor 0%,
            currentColor 30%,
            transparent 30%,
            transparent 70%,
            currentColor 70%,
            currentColor 100%);
}

.wall-overlay.office {
    background: linear-gradient(270deg,
            currentColor 0%,
            currentColor 35%,
            transparent 35%,
            transparent 65%,
            currentColor 65%,
            currentColor 100%);
}

.color-palette {
    bottom: 70px;
    left: 20px;
    right: 20px;
    z-index: 4;
}

.palette-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.palette-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 0 0 8px 8px;
    backdrop-filter: blur(10px);
}

.color-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.color-row:last-child {
    margin-bottom: 0;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border: 3px solid #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-swatch.selected {
    border-color: #1f2937;
    box-shadow: 0 0 0 2px #1f2937, 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #1f2937;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.right-panel {
    flex-basis: 40%;
    max-width: 40%;
    background: #fff;
    padding: 32px 24px;
    overflow-y: auto;
    border-left: 1px solid #e5e7eb;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section {
    background: #f8fafc;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 20px 18px 18px 18px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.section-icon {
    font-size: 22px;
    background: #fbbf24;
    color: #fff;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.12);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.upload-area {
    background: #f1f5f9;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

button.btn,
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-top: 4px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.08);
}

.btn-primary {
    background: linear-gradient(90deg, #fbbf24 60%, #f59e42 100%);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #f59e42 60%, #fbbf24 100%);
}

.btn-secondary {
    background: #e0e7ef;
    color: #374151;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.room-thumbnail {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    background: #fff;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-thumbnail.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6, 0 2px 8px rgba(59, 130, 246, 0.08);
    transform: scale(1.04);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.slider-value {
    min-width: 40px;
    font-size: 15px;
    color: #f59e42;
    font-weight: 600;
}

input[type="range"].slider {
    flex: 1;
    accent-color: #f59e42;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
}

input[type="range"].slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.15);
    cursor: pointer;
    border: 2px solid #fff;
}

input[type="range"].slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.15);
    cursor: pointer;
    border: 2px solid #fff;
}

input[type="range"].slider::-ms-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.15);
    cursor: pointer;
    border: 2px solid #fff;
}

.room-thumbnail:hover {
    transform: scale(1.05);
}

.room-thumbnail.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.room-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.current-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
}

.wall-intensity-control {
    margin-top: 12px;
}

.intensity-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.intensity-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f97316;
    cursor: pointer;
}

.popup-container {
    height: 90vh;
    margin: auto;
}

.action-section {
    flex-direction: column;
}

.room-image-container .button#fabric-download-btn {
    left: 0 !important;
    right: auto !important;
    width: 40% !important;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, #4f8cff 0%, #2357d5 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(79, 140, 255, 0.15);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.download-btn svg {
    margin-right: 6px;
    fill: currentColor;
}
.download-btn:hover, .download-btn:focus {
    background: linear-gradient(90deg, #2357d5 0%, #4f8cff 100%);
    box-shadow: 0 4px 16px rgba(79, 140, 255, 0.25);
    transform: translateY(-2px) scale(1.03);
    outline: none;
}