/* ========================================
   WINDRAD AR - STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    overflow-x: hidden;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    background: linear-gradient(135deg, #1a5f3b 0%, #2e7d4e 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header h1 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}

.header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ========================================
   CONTAINER
   ======================================== */

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   MAP SECTION
   ======================================== */

.map-section {
    background: white;
    margin: 1rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#map {
    height: 400px;
    width: 100%;
}

.map-info {
    padding: 1rem;
    background: #f5f5f5;
    border-top: 2px solid #1a5f3b;
}

/* ========================================
   INFO GRID
   ======================================== */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.info-item {
    background: white;
    padding: 0.8rem;
    border-radius: 6px;
    border-left: 3px solid #1a5f3b;
}

.info-item strong {
    display: block;
    color: #1a5f3b;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.info-item span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ========================================
   VISIBILITY INFO
   ======================================== */

.visibility-info {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    border-left: 4px solid #2196F3;
}

.visibility-info.blocked {
    border-left-color: #f44336;
}

.visibility-info.partial {
    border-left-color: #ff9800;
}

.visibility-info h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.visibility-details {
    font-size: 0.9rem;
    color: #666;
}

.visibility-details div {
    margin: 0.3rem 0;
}

/* ========================================
   ELEVATION PROFILE
   ======================================== */

.elevation-profile {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

#elevationCanvas {
    width: 100%;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    display: block;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #1a5f3b 0%, #2e7d4e 100%);
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ========================================
   TURBINE LIST
   ======================================== */

.turbine-list {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.turbine-item {
    background: white;
    padding: 1rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.turbine-item:hover {
    border-color: #1a5f3b;
    box-shadow: 0 2px 8px rgba(26, 95, 59, 0.2);
}

.turbine-item.active {
    border-color: #1a5f3b;
    background: #f0f7f3;
}

.turbine-item h4 {
    color: #1a5f3b;
    margin-bottom: 0.5rem;
}

.turbine-meta {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ========================================
   CAMERA VIEW
   ======================================== */

.camera-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 1000;
}

.camera-view.active {
    display: flex;
    flex-direction: column;
}

#cameraPreview {
    flex: 1;
    width: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* ========================================
   DIRECTION INDICATOR
   ======================================== */

.direction-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 95, 59, 0.95);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.direction-indicator.perfect {
    background: rgba(76, 175, 80, 0.95);
}

.direction-arrow {
    font-size: 1.5rem;
}

.compass-display {
    position: absolute;
    top: 100px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.debug-info {
    position: absolute;
    bottom: 120px;
    left: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    max-width: 200px;
}

/* ========================================
   CAMERA CONTROLS
   ======================================== */

.camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%);
    padding: 2rem 1rem 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    pointer-events: all;
}

.camera-btn {
    padding: 1.2rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.camera-btn-capture {
    background: white;
    color: #1a5f3b;
    flex: 2;
}

.camera-btn-close {
    background: rgba(255,255,255,0.2);
    color: white;
    flex: 1;
}

/* ========================================
   RESULT CANVAS
   ======================================== */

#resultCanvas {
    display: none;
}

/* ========================================
   LOADING
   ======================================== */

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

.loading.active {
    display: flex;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Photo Result View */
.photo-result {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.photo-result.active {
    display: flex;
}

.result-header {
    background: rgba(26, 95, 59, 0.95);
    color: white;
    padding: 1rem;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.result-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.result-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: auto;
}

.result-image-container img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 8px;
}

.result-controls {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.result-controls .btn {
    flex: 1;
    min-width: 120px;
}
