/* Reset and base styles for faster rendering */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

nav {
    background: #333;
    padding: 1rem;
    text-align: center;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 1rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: #555;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2rem;
}

h1, h2, h3 {
    color: #333;
    margin-bottom: 1rem;
}

/* Feature grid for homepage */
.feature-grid, .admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card, .admin-card {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Kitchen Visualizer Styles */
.visualizer-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.kitchen-preview {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
}

#kitchen-canvas {
    width: 100%;
    height: 500px;
    border: 3px solid #8B4513;
    border-radius: 12px;
    margin-bottom: 1rem;
    position: relative;
    background: linear-gradient(135deg, #faf5f0 0%, #f0e6d2 100%);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    perspective: 1000px;
}

.kitchen-layout {
    height: 100%;
    position: relative;
    padding: 0;
}

.cabinet-section {
    position: absolute;
    background: linear-gradient(145deg, rgba(212,184,150,0.7) 0%, rgba(201,168,118,0.7) 50%, rgba(181,152,88,0.7) 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(0,0,0,0.3),
        0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid rgba(139,69,19,0.4);
    overflow: hidden;
    opacity: 0.75;
}

/* Upper cabinet sections - matching photo layout */
#upper-cabinets-left {
    top: 8%;
    left: 5%;
    width: 40%;
    height: 28%;
}

#upper-cabinets-center {
    display: none;
}

#upper-cabinets-right {
    top: 8%;
    left: 55%;
    width: 35%;
    height: 28%;
}

/* Lower cabinet sections - matching photo layout */
#lower-cabinets-left {
    bottom: 8%;
    left: 5%;
    width: 25%;
    height: 35%;
}

#lower-cabinets-center {
    bottom: 8%;
    left: 35%;
    width: 20%;
    height: 35%;
}

#lower-cabinets-right {
    bottom: 8%;
    left: 58%;
    width: 12%;
    height: 35%;
}

/* Island cabinets - hidden for this layout */
#island-cabinets {
    display: none;
}

.cabinet-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.1) 20%, 
        rgba(255,255,255,0.2) 40%, 
        transparent 60%, 
        rgba(0,0,0,0.05) 80%, 
        transparent 100%);
    pointer-events: none;
}

.countertop-section {
    position: absolute;
    bottom: 42%;
    left: 10%;
    width: 80%;
    height: 8%;
    background: linear-gradient(145deg, rgba(102,102,102,0.8) 0%, rgba(85,85,85,0.8) 50%, rgba(68,68,68,0.8) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.2),
        inset 0 -2px 4px rgba(0,0,0,0.4),
        0 4px 8px rgba(0,0,0,0.2);
    border: 1px solid rgba(0,0,0,0.3);
    opacity: 0.8;
}

.countertop-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.4) 0%, 
        rgba(255,255,255,0.8) 50%, 
        rgba(255,255,255,0.4) 100%);
    border-radius: 8px 8px 0 0;
}

.lighting-section {
    position: absolute;
    top: 35%;
    left: 42%;
    width: 16%;
    height: 8%;
    background: linear-gradient(145deg, rgba(248,248,248,0.8) 0%, rgba(232,232,232,0.8) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.1),
        inset 0 1px 2px rgba(255,255,255,0.8);
    opacity: 0.85;
}

.lighting-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #fff 0%, #f0f0f0 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(255,255,0,0.3);
}

.backsplash-section {
    position: absolute;
    top: 32%;
    left: 10%;
    width: 80%;
    height: 8%;
    background: linear-gradient(145deg, rgba(232,232,232,0.8) 0%, rgba(216,216,216,0.8) 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid #ccc;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.6),
        inset 0 -1px 2px rgba(0,0,0,0.1);
    overflow: hidden;
    opacity: 0.75;
}

.backsplash-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 11px
    );
}

.appliance-section {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 15%;
    height: 35%;
    background: linear-gradient(145deg, rgba(245,245,245,0.8) 0%, rgba(224,224,224,0.8) 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid #bbb;
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.7),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 2px 6px rgba(0,0,0,0.15);
    opacity: 0.8;
}

.appliance-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #333 0%, #555 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.hardware-preview {
    position: absolute;
    top: 50%;
    right: 10%;
    width: 10%;
    height: 20%;
    background: radial-gradient(circle, rgba(192,192,192,0.8) 0%, rgba(136,136,136,0.8) 100%);
    border-radius: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.2);
}

.sink-preview {
    position: absolute;
    bottom: 55%;
    left: 40%;
    width: 20%;
    height: 12%;
    background: linear-gradient(145deg, rgba(248,248,248,0.8) 0%, rgba(232,232,232,0.8) 100%);
    border: 2px solid #ccc;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        inset 0 2px 6px rgba(0,0,0,0.2),
        0 1px 3px rgba(0,0,0,0.1);
    opacity: 0.8;
}

.sink-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 50%;
    background: radial-gradient(ellipse, #d0d0d0 0%, #b0b0b0 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.faucet-preview {
    position: absolute;
    top: -80%;
    right: 30%;
    width: 20%;
    height: 80%;
    background: linear-gradient(145deg, rgba(192,192,192,0.8) 0%, rgba(160,160,160,0.8) 100%);
    border: 1px solid #888;
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.4);
}

.faucet-preview::before {
    content: '';
    position: absolute;
    top: -10%;
    left: 50%;
    width: 60%;
    height: 30%;
    background: radial-gradient(circle, #e0e0e0 0%, #c0c0c0 100%);
    border-radius: 50%;
    transform: translateX(-50%);
    border: 1px solid #999;
}

.cabinet-display, .countertop-display, .lighting-display, .backsplash-display, .appliance-display {
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 1;
    position: relative;
    background: rgba(0,0,0,0.6);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

.sink-display, .faucet-display {
    color: white;
    font-weight: bold;
    font-size: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 1;
    background: rgba(0,0,0,0.6);
    padding: 2px 4px;
    border-radius: 3px;
    backdrop-filter: blur(2px);
}

.price-calculator {
    background: #e9ecef;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.price-calculator h3 {
    color: #28a745;
    font-size: 1.5rem;
}

.options-panel {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.options-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
}

.tab-btn {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    color: #007bff;
    background: #ffffff;
    border-bottom-color: #007bff;
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.thumbnail-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.thumbnail-option:hover {
    transform: translateY(-2px);
}

.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid #ddd;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s ease;
}

.thumbnail-option:hover .thumbnail {
    border-color: #007bff;
}

.appliance-thumb {
    background: linear-gradient(45deg, #c0c0c0 25%, #a0a0a0 25%, #a0a0a0 50%, #c0c0c0 50%, #c0c0c0 75%, #a0a0a0 75%);
    background-size: 8px 8px;
}

.hardware-thumb {
    border-radius: 50%;
    width: 60px;
    height: 60px;
}

.lighting-thumb {
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.sink-thumb {
    background: #e8e8e8;
    border-radius: 12px;
    position: relative;
}

.sink-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 10px;
    background: #d0d0d0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.faucet-thumb {
    background: #c0c0c0;
    border-radius: 4px 4px 50% 50%;
    position: relative;
}

.faucet-thumb::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    width: 6px;
    height: 20px;
    background: #a0a0a0;
    border-radius: 2px;
    transform: translateX(-50%);
}

.thumbnail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    text-align: center;
    margin-bottom: 0.25rem;
}

.thumbnail-price {
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
    font-weight: 400;
}

/* Admin Panel Styles */
.admin-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-form input, .admin-form select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.item-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item-card h4 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.item-card p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Form styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
}

input, select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    padding: 8px 16px;
    margin: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .visualizer-container {
        grid-template-columns: 1fr;
    }

    .admin-form {
        grid-template-columns: 1fr;
    }

    .feature-grid, .admin-grid {
        grid-template-columns: 1fr;
    }

    .thumbnails-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .options-tabs {
        flex-direction: row;
        overflow-x: auto;
    }

    .tab-btn {
        min-width: 100px;
        white-space: nowrap;
    }

    main {
        margin: 1rem;
        padding: 1rem;
    }
}