/* VastuShastra - Main Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #FFC107;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --background: #f8fafc;
    --card-background: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    background: var(--card-background);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #dbeafe;
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.upload-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.upload-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 20px;
}

/* Progress */
.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

/* Editor Section */
.editor-section {
    margin-top: 40px;
    min-height: 100vh;
    display: block;
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.canvas-container {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

#mainImage {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.compass-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    width: 80%;
    height: 80%;
    max-width: 500px;
    max-height: 500px;
}

/* Controls Panel */
.controls-panel {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.control-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Tool Buttons */
.tool-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.btn-tool {
    padding: 12px;
    font-size: 0.9rem;
}

/* Rotation Controls */
.rotation-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

/* Slider Controls */
.slider-control {
    margin-bottom: 15px;
}

.slider-control label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.slider-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 10px;
}

/* Checkbox Control */
.checkbox-control {
    margin: 15px 0;
}

.checkbox-control label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-control input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Direction Menu */
.direction-menu {
    max-height: 400px;
    overflow-y: auto;
}

.direction-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.direction-item:hover {
    background: #f8fafc;
}

.direction-item.selected {
    background: #dbeafe;
    border-color: var(--primary-color);
}

.direction-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.direction-item input[type="checkbox"] {
    margin-right: 10px;
}

.direction-label {
    font-weight: 500;
    color: var(--text-primary);
}

.direction-angle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.btn-group {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-large {
    max-width: 800px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
}

.close:hover {
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Camera */
#cameraVideo {
    width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

/* Cropper */
.cropper-container {
    margin: 20px 0;
    max-height: 400px;
}

.crop-controls {
    margin: 15px 0;
}

.crop-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-primary);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .tool-buttons {
        grid-template-columns: 1fr;
    }

    .rotation-buttons {
        grid-template-columns: 1fr;
    }
}
