﻿/* calculator.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

.calc-root {
    font-family: 'DM Sans', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

.calc-header {
    background: linear-gradient(to right, #1e293b, #334155);
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.calc-header h1 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.calc-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Map */
.calc-map-wrapper {
    flex: 1;
    position: relative;
    background-color: #e5e7eb;
    z-index: 1;
    min-width: 0;
}

.calc-map-wrapper #calc-map {
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* Map controls */
.calc-map-controls {
    position: absolute;
    top: 60px;
    right: 20px;
    z-index: 999;
    display: flex;
    gap: 8px;
}

.calc-map-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
}
.calc-map-btn:hover { transform: scale(1.05); }
.calc-map-btn svg { width: 24px; height: 24px; }
.calc-map-btn.active { opacity: 0.6; }

.btn-draw { background: #10b981; }
.btn-draw:hover { background: #059669; }
.btn-clear { background: #ef4444; }
.btn-clear:hover { background: #dc2626; }
.btn-layer { background: #6366f1; }
.btn-layer:hover { background: #4f46e5; }
.btn-container { background: #f59e0b; }
.btn-container:hover { background: #d97706; }
.btn-sprinkler { background: #06b6d4; }
.btn-sprinkler:hover { background: #0891b2; }
.btn-power { background: #ec4899; }
.btn-power:hover { background: #be185d; }

/* Results panel */
.calc-panel {
    width: 440px;
    background: #fff;
    flex-shrink: 0;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    gap: 1rem;
}

/* Cards */
.calc-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.calc-info-box {
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid;
}
.calc-info-box.blue { background: #eff6ff; border-color: #bfdbfe; }
.calc-info-box.amber { background: #fffbeb; border-color: #fde68a; }
.calc-info-box.orange { background: #fff7ed; border-color: #fed7aa; }
.calc-info-box.green { background: #ecfdf5; border-color: #a7f3d0; }

.calc-info-box h5 { font-size: 0.875rem; font-weight: 700; margin: 0 0 0.5rem 0; }
.calc-info-box p { font-size: 0.75rem; margin: 0; line-height: 1.5; }
.calc-info-box ol { font-size: 0.75rem; padding-left: 1.25rem; margin: 0; }
.calc-info-box ol li { margin-bottom: 0.25rem; }

/* Form elements */
.calc-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.calc-input, .calc-select, .calc-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.calc-input:focus, .calc-select:focus, .calc-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.calc-textarea { resize: none; }

/* Stand card */
.calc-stand-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.calc-stand-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: #10b981;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.calc-stand-info { flex: 1; }
.calc-stand-info .label { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; font-weight: 500; }
.calc-stand-info .value { font-size: 1.5rem; font-weight: 700; color: #1e293b; }

/* Buttons */
.calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}
.calc-btn:disabled { background: #94a3b8 !important; cursor: not-allowed; }
.calc-btn.primary {
    background: linear-gradient(to right, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 6px rgba(16,185,129,0.3);
}
.calc-btn.primary:hover:not(:disabled) { background: linear-gradient(to right, #059669, #047857); }
.calc-btn.secondary { background: #3b82f6; color: #fff; }
.calc-btn.secondary:hover { background: #2563eb; }
.calc-btn svg { width: 1.25rem; height: 1.25rem; }

/* Price section */
.calc-price-box {
    background: linear-gradient(to right, #fffbeb, #fff7ed);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}
.calc-price-box .price { font-size: 1.5rem; font-weight: 700; color: #b45309; }
.calc-price-box .note { font-size: 0.75rem; color: #92400e; margin-top: 0.25rem; }

/* Toast */
.calc-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calc-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: calcSlideIn 0.3s ease-out;
    transition: opacity 0.3s;
}
.calc-toast.success { background: #10b981; }
.calc-toast.warning { background: #f59e0b; }
.calc-toast.error { background: #ef4444; }

@keyframes calcSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Indicator */
.calc-indicator {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}
.calc-indicator.placed { background: #ecfdf5; color: #065f46; }

/* Image preview */
.calc-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.calc-image-item { position: relative; }
.calc-image-item img {
    width: 100%;
    height: 5rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}
.calc-image-item .remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.calc-image-item:hover .remove-btn { opacity: 1; }

/* Responsive */
@media (max-width: 768px) {
    .calc-main { flex-direction: column; }
    .calc-panel { width: 100%; height: auto; max-height: 60vh; }
    .calc-map-wrapper { min-height: 40vh; }
}

/* Upload button */
.calc-upload-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    background: #dbeafe;
    border: 2px dashed #93c5fd;
    border-radius: 0.5rem;
    color: #1d4ed8;
    font-weight: 500;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}
.calc-upload-btn:hover { background: #bfdbfe; }
