/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f0f0f0;
}

h1 {
    color: #333;
    font-size: 2.5em;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

header p {
    color: #666;
    font-size: 1.2em;
    margin: 0;
}

/* Layout Styles */
.builder-layout {
    display: flex;
    gap: 30px;
    min-height: 600px;
}

.controls-panel {
    flex: 1;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    max-height: 80vh;
    overflow-y: auto;
}

.preview-panel {
    flex: 2;
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    position: relative;
}

/* Controls Panel Styles */
.controls-panel h2 {
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.layer-section {
    margin-bottom: 25px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.layer-section h3 {
    color: #343a40;
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    font-size: 0.95em;
}

.option-group label:hover {
    background-color: #f8f9fa;
}

.option-group input[type="radio"],
.option-group input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

/* Preview Panel Styles */
.preview-panel h2 {
    color: #495057;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.house-preview {
    position: relative;
    height: 500px;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 70%, #90EE90 100%);
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid #ddd;
    perspective: 1000px;
}

/* 3D House Container */
.house-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotateX(15deg) rotateY(-10deg);
    width: 350px;
    height: 350px;
    transform-style: preserve-3d;
}

/* Layer Base Styling */
.layer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 5px;
}

/* Base Layer Styles */
.layer.base {
    bottom: -50px;
    height: 60px;
    border-radius: 8px;
}

.layer.base.grass {
    background: linear-gradient(45deg, #90EE90, #98FB98, #90EE90);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.layer.base.dirt {
    background: linear-gradient(45deg, #8B4513, #A0522D, #8B4513);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.layer.base.sand {
    background: linear-gradient(45deg, #F4A460, #DEB887, #F4A460);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.layer.base.stone {
    background: linear-gradient(45deg, #708090, #778899, #708090);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Flooring Styles */
.layer.flooring {
    bottom: -10px;
    height: 20px;
    border-radius: 5px;
}

.layer.flooring.wood {
    background: 
        linear-gradient(90deg, 
            #8B4513 0%, #A0522D 20%, #8B4513 40%,
            #A0522D 60%, #8B4513 80%, #A0522D 100%);
    background-size: 40px 100%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.layer.flooring.bamboo {
    background: 
        linear-gradient(90deg, 
            #DAA520 0%, #B8860B 20%, #DAA520 40%,
            #B8860B 60%, #DAA520 80%, #B8860B 100%);
    background-size: 25px 100%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.layer.flooring.paper {
    background: linear-gradient(45deg, #FFF8DC, #F5F5DC, #FFF8DC);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.layer.flooring.fleece {
    background: linear-gradient(45deg, #FFB6C1, #FFC0CB, #FFB6C1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* Exterior Walls */
.layer.exterior-walls {
    transform-style: preserve-3d;
}

.wall-front, .wall-right, .wall-left, .wall-back {
    position: absolute;
    width: 350px;
    height: 250px;
    border-radius: 5px 5px 0 0;
}

.wall-front {
    transform: translateZ(175px);
}

.wall-back {
    transform: translateZ(-175px) rotateY(180deg);
}

.wall-right {
    transform: rotateY(90deg) translateZ(175px);
}

.wall-left {
    transform: rotateY(-90deg) translateZ(175px);
}

/* Exterior Wall Styles */
.exterior-walls.log-cabin .wall-front,
.exterior-walls.log-cabin .wall-right,
.exterior-walls.log-cabin .wall-left,
.exterior-walls.log-cabin .wall-back {
    background: 
        repeating-linear-gradient(
            0deg,
            #8B4513 0px, #8B4513 20px,
            #A0522D 20px, #A0522D 22px
        );
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.exterior-walls.brick .wall-front,
.exterior-walls.brick .wall-right,
.exterior-walls.brick .wall-left,
.exterior-walls.brick .wall-back {
    background: 
        repeating-linear-gradient(
            0deg,
            #B22222 0px, #B22222 15px,
            #8B0000 15px, #8B0000 17px
        ),
        repeating-linear-gradient(
            90deg,
            #B22222 0px, #B22222 30px,
            #8B0000 30px, #8B0000 32px
        );
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
}

.exterior-walls.siding .wall-front,
.exterior-walls.siding .wall-right,
.exterior-walls.siding .wall-left,
.exterior-walls.siding .wall-back {
    background: 
        repeating-linear-gradient(
            0deg,
            #DEB887 0px, #DEB887 12px,
            #D2B48C 12px, #D2B48C 14px
        );
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.exterior-walls.stone .wall-front,
.exterior-walls.stone .wall-right,
.exterior-walls.stone .wall-left,
.exterior-walls.stone .wall-back {
    background: 
        radial-gradient(circle at 20% 20%, #778899 0%, #708090 50%),
        radial-gradient(circle at 80% 80%, #696969 0%, #778899 50%);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

/* Interior Walls */
.layer.interior-walls {
    transform-style: preserve-3d;
    transform: translateZ(20px);
}

.interior-wall-front, .interior-wall-left, .interior-wall-right, .interior-wall-back {
    position: absolute;
    width: 310px;
    height: 200px;
    border-radius: 3px;
    margin: 20px;
}

.interior-wall-front {
    transform: translateZ(155px);
}

.interior-wall-back {
    transform: translateZ(-155px) rotateY(180deg);
}

.interior-wall-right {
    transform: rotateY(90deg) translateZ(155px);
}

.interior-wall-left {
    transform: rotateY(-90deg) translateZ(155px);
}

/* Interior Wall Styles */
.interior-walls.natural-wood .interior-wall-front,
.interior-walls.natural-wood .interior-wall-left,
.interior-walls.natural-wood .interior-wall-right,
.interior-walls.natural-wood .interior-wall-back {
    background: linear-gradient(45deg, #DEB887, #D2B48C, #DEB887);
}

.interior-walls.painted-white .interior-wall-front,
.interior-walls.painted-white .interior-wall-left,
.interior-walls.painted-white .interior-wall-right,
.interior-walls.painted-white .interior-wall-back {
    background: linear-gradient(45deg, #F8F8FF, #FFFFFF, #F8F8FF);
}

.interior-walls.painted-blue .interior-wall-front,
.interior-walls.painted-blue .interior-wall-left,
.interior-walls.painted-blue .interior-wall-right,
.interior-walls.painted-blue .interior-wall-back {
    background: linear-gradient(45deg, #E6F3FF, #B0E0E6, #E6F3FF);
}

.interior-walls.cardboard .interior-wall-front,
.interior-walls.cardboard .interior-wall-left,
.interior-walls.cardboard .interior-wall-right,
.interior-walls.cardboard .interior-wall-back {
    background: linear-gradient(45deg, #DEB887, #D2B48C, #DEB887);
    border: 2px dashed #A0522D;
}

/* Hamster Character */
.hamster-character {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    cursor: pointer;
}

.hamster-body {
    position: relative;
    width: 60px;
    height: 40px;
    background: linear-gradient(145deg, #DEB887, #F4A460);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.hamster-head {
    position: absolute;
    width: 45px;
    height: 35px;
    background: linear-gradient(145deg, #DEB887, #F4A460);
    border-radius: 50%;
    top: -20px;
    left: 7.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.hamster-ear {
    position: absolute;
    width: 12px;
    height: 12px;
    background: linear-gradient(145deg, #D2B48C, #DEB887);
    border-radius: 50%;
    top: 5px;
}

.hamster-ear.left {
    left: 8px;
    transform: rotate(-30deg);
}

.hamster-ear.right {
    right: 8px;
    transform: rotate(30deg);
}

.hamster-eye {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #333;
    border-radius: 50%;
    top: 12px;
}

.hamster-eye.left {
    left: 12px;
}

.hamster-eye.right {
    right: 12px;
}

.hamster-nose {
    position: absolute;
    width: 4px;
    height: 3px;
    background: #FF69B4;
    border-radius: 50%;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
}

.hamster-cheeks {
    position: absolute;
    width: 10px;
    height: 8px;
    background: linear-gradient(145deg, #FFB6C1, #FFC0CB);
    border-radius: 50%;
    top: 15px;
}

.hamster-cheeks.left {
    left: 2px;
}

.hamster-cheeks.right {
    right: 2px;
}

.hamster-tail {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(145deg, #D2B48C, #DEB887);
    border-radius: 50%;
    bottom: -2px;
    right: -3px;
}

.hamster-paws {
    position: absolute;
    width: 20px;
    height: 6px;
    background: linear-gradient(145deg, #D2B48C, #DEB887);
    border-radius: 50%;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
}

/* Furnishings */
.furnishings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.furnishing-item {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    pointer-events: auto;
    cursor: move;
}

/* Bedroom Furnishings */
.furnishing-item.hideout {
    background: linear-gradient(145deg, #8B4513, #A0522D);
    border-radius: 50% 50% 0 0;
}

.furnishing-item.soft-bed {
    background: linear-gradient(145deg, #FFB6C1, #FFC0CB);
    border-radius: 8px;
}

.furnishing-item.tunnel {
    background: linear-gradient(145deg, #696969, #778899);
    border-radius: 50%;
    width: 40px;
    height: 20px;
}

.furnishing-item.hammock {
    background: linear-gradient(145deg, #F0E68C, #DDA0DD);
    border-radius: 15px 15px 5px 5px;
    width: 35px;
    height: 15px;
}

/* Eating Area Furnishings */
.furnishing-item.food-bowl {
    background: radial-gradient(circle, #FF6347 0%, #DC143C 100%);
    border-radius: 50%;
    width: 25px;
    height: 25px;
}

.furnishing-item.water-bottle {
    background: linear-gradient(145deg, #87CEEB, #4682B4);
    border-radius: 3px 3px 8px 8px;
    width: 15px;
    height: 35px;
}

.furnishing-item.treat-dispenser {
    background: linear-gradient(145deg, #DAA520, #B8860B);
    border-radius: 3px;
    width: 20px;
    height: 30px;
}

.furnishing-item.hay-rack {
    background: linear-gradient(145deg, #DEB887, #D2B48C);
    border-radius: 2px;
    width: 30px;
    height: 20px;
}

/* Outside Area Furnishings */
.furnishing-item.litter-box {
    background: linear-gradient(145deg, #A9A9A9, #696969);
    border-radius: 3px;
    width: 35px;
    height: 25px;
}

.furnishing-item.exercise-wheel {
    background: radial-gradient(circle, #C0C0C0 40%, #808080 70%);
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.furnishing-item.climbing-structure {
    background: linear-gradient(145deg, #8B4513, #A0522D);
    border-radius: 2px;
    width: 25px;
    height: 40px;
}

.furnishing-item.digging-pit {
    background: linear-gradient(145deg, #DEB887, #D2B48C);
    border-radius: 8px;
    width: 40px;
    height: 30px;
}

/* Placement Grid */
.placement-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    background-image: 
        linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    transition: opacity 0.3s ease;
}

.placement-grid.active {
    opacity: 1;
}

/* Action Buttons */
.save-design, .share-design {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 10px 5px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.save-design:hover, .share-design:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.share-design {
    background: linear-gradient(145deg, #2196F3, #1976D2);
}

/* Animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes hamsterMessagePop {
    0% { transform: scale(0) translateY(20px); opacity: 0; }
    50% { transform: scale(1.1) translateY(-5px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes hamsterMessageFade {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-30px); }
    60% { transform: translateX(-50%) translateY(-15px); }
}

@keyframes sparkleFloat {
    0% { opacity: 0; transform: translateY(20px) scale(0); }
    50% { opacity: 1; transform: translateY(-10px) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.5); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .builder-layout {
        flex-direction: column;
    }
    
    .controls-panel {
        max-height: none;
        margin-bottom: 20px;
    }
    
    .house-preview {
        height: 400px;
    }
    
    .house-container {
        width: 280px;
        height: 280px;
    }
}

/* Interactive States */
.furnishing-item:hover {
    transform: scale(1.1);
    z-index: 10;
}

.furnishing-item.dragging {
    transform: scale(1.2);
    opacity: 0.8;
    z-index: 20;
}

.hamster-character:hover {
    animation: bounce 1s ease-in-out;
}

/* Message Bubble for Hamster */
.hamster-message {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
    animation: hamsterMessagePop 0.5s ease-out;
}

.hamster-message::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.95);
}

.hamster-message.fade-out {
    animation: hamsterMessageFade 0.3s ease-in forwards;
}

/* Sparkle Effects */
.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    animation: sparkleFloat 2s ease-out forwards;
    pointer-events: none;
}

/* Loading State */
.loading {
    position: relative;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}