/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.version {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

.header-right {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-left {
    border-right: 1px solid #e5e7eb;
}

.sidebar-right {
    border-left: 1px solid #e5e7eb;
}

.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #374151;
}

/* Telemetry Items */
.telemetry-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.telemetry-item {
    padding: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.telemetry-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.telemetry-item:active {
    cursor: grabbing;
}

.telemetry-item-name {
    font-weight: 500;
    color: #374151;
}

.telemetry-item-type {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Widget Properties */
.widget-properties {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.no-selection {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px dashed #d1d5db;
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.property-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.property-group input,
.property-group select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Property group variations */
.property-group.inline {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.property-group.inline label {
    min-width: 80px;
    margin: 0;
}

.property-group.inline input,
.property-group.inline select {
    flex: 1;
}

/* Property section headers */
.property-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1rem;
}

.property-section:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.property-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    min-width: 0; /* Allow flex shrinking */
}

.canvas-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#zoomLevel {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    overflow: auto;
}

.canvas {
    width: 480px;
    height: 272px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    position: relative;
    transform-origin: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.canvas.drag-over {
    border-color: #10b981;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(16, 185, 129, 0.5);
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0.1;
    background-image: 
        linear-gradient(to right, #666 1px, transparent 1px),
        linear-gradient(to bottom, #666 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Widget Styles */
.widget {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: move;
    user-select: none;
    transition: border-color 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: monospace;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
}

.widget:hover {
    border-color: #3b82f6;
}

.widget.selected {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.widget.dragging {
    opacity: 0.8;
    z-index: 1000;
}

/* Widget Types */
.widget.numeric {
    background: rgba(59, 130, 246, 0.2);
}

.widget.bar {
    background: rgba(16, 185, 129, 0.2);
}

.widget.text {
    background: rgba(245, 158, 11, 0.2);
}

.widget.attitude {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 50%;
}

.widget.compass {
    background: rgba(236, 72, 153, 0.2);
    border-radius: 50%;
}

.widget.timer {
    background: rgba(239, 68, 68, 0.2);
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    background: #10b981;
    border: 1px solid white;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
    
    .canvas-container {
        padding: 1rem;
    }
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-left: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .sidebar-right {
        border-top: 1px solid #e5e7eb;
        border-bottom: none;
    }
    
    .canvas-area {
        flex: 1;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .header-right {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sidebar {
        max-height: 150px;
    }

    .canvas {
        transform-origin: top left;
    }
} 