:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --background-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --light-bg: #f8f9fa;
    --white-bg: rgba(255, 255, 255, 0.95);
    --text-color: #495057;
    --heading-color: #333;
    --border-color: #e9ecef;
    --focus-border-color: var(--primary-color);
    --error-color: #dc3545;
    --border-radius-lg: 20px;
    --border-radius-md: 15px;
    --border-radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-gradient);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white-bg);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    color: var(--heading-color);
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 300;
}

.input-section {
    background: var(--light-bg);
    padding: 25px;
    border-radius: var(--border-radius-md);
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--focus-border-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dimension-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: end;
}

.multiply-sign {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    padding-bottom: 12px;
}

.calculate-btn {
    background: var(--background-gradient);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius-sm);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.results {
    background: #ffffff;
    border-radius: var(--border-radius-md);
    padding: 25px;
    margin-top: 30px;
    border: 2px solid var(--border-color);
    display: none;
}

.results.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: var(--light-bg);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--primary-color);
    position: relative;
}

.result-label {
    font-weight: 600;
    color: var(--text-color);
}

.result-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 40px; /* Space for copy button */
}

.primary-result {
    background: var(--background-gradient);
    color: white;
    font-size: 20px;
    margin-bottom: 20px;
}

.primary-result .result-label,
.primary-result .result-value {
    color: white;
}

.copy-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e9ecef;
    border: none;
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #dee2e6;
}

.copy-btn.copied {
    background: #28a745;
    color: white;
}

.conversion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 5px;
    display: block;
    height: 1em;
}

.map-section {
    background: #ffffff;
    border-radius: var(--border-radius-md);
    padding: 25px;
    margin-top: 20px;
    border: 2px solid var(--border-color);
    display: none;
}

.map-section.show {
    display: block;
    animation: slideIn 0.5s ease;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.map-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--heading-color);
}

.map-controls {
    display: flex;
    gap: 10px;
}

.zoom-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.zoom-btn:hover {
    background: #5a6fd8;
}

.map-container {
    width: 100%;
    height: 400px;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-sm);
    position: relative;
    overflow: hidden;
}

.floor-plan {
    position: absolute;
    background: rgba(102, 126, 234, 0.2);
    border: 3px solid var(--primary-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--heading-color);
}

.dimension-labels {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--primary-color);
    white-space: nowrap;
    z-index: 10;
}

.length-label {
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.width-label {
    top: 50%;
    right: -30px;
    transform: translateY(-50%) rotate(90deg);
    transform-origin: center;
}

.map-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
}

.scale-info {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.examples {
    background: #e3f2fd;
    padding: 20px;
    border-radius: var(--border-radius-sm);
    margin-top: 20px;
}

.examples h3 {
    color: #1976d2;
    margin-bottom: 15px;
}

.example-item {
    margin-bottom: 8px;
    font-family: monospace;
    background: white;
    padding: 8px;
    border-radius: 5px;
}

@media (max-width: 600px) {
    .dimension-inputs {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .multiply-sign {
        display: none;
    }
    .container {
        padding: 20px;
    }
}