/* Custom CSS for Meshkati Light Distribution Wizard - Laravel Livewire */

/* Brand Colors */
:root {
    --brand-color: #A42A2B;
    --brand-color-light: #c53a3b;
    --brand-color-dark: #8a1f20;
    --brand-color-rgb: 164, 42, 43;
}

/* Typography */
body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Brand Color Classes */
.text-brand {
    color: var(--brand-color) !important;
}

.bg-brand {
    background-color: var(--brand-color) !important;
}

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

.btn-brand:hover,
.btn-brand:focus {
    background-color: var(--brand-color-dark);
    border-color: var(--brand-color-dark);
    color: white;
}

.btn-outline-brand {
    color: var(--brand-color);
    border-color: var(--brand-color);
}

.btn-outline-brand:hover {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
    color: white;
}

/* Wizard Container */
.wizard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.wizard-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

/* Progress Bar */
.progress {
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand-color) 0%, var(--brand-color-light) 100%);
    transition: width 0.5s ease;
}

/* Step Indicators */
.step-indicators {
    max-width: 600px;
    margin: 0 auto;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
    text-align: center;
}

.step-indicator.active {
    opacity: 1;
}

.step-indicator.completed {
    opacity: 0.8;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.step-indicator.active .step-number {
    background: var(--brand-color);
    color: white;
}

.step-indicator.completed .step-number {
    background: #28a745;
    color: white;
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    max-width: 80px;
}

.step-indicator.active .step-label {
    color: var(--brand-color);
    font-weight: 600;
}

/* Main Content */
.wizard-content {
    flex: 1;
    padding: 2rem 0;
}

.wizard-step {
    display: none;
    animation: fadeIn 0.5s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-color-rgb), 0.25);
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.product-card:hover {
    border-color: var(--brand-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card.selected {
    border-color: var(--brand-color);
    background: rgba(var(--brand-color-rgb), 0.05);
}

.product-card.selected::before {
    content: '✓';
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 24px;
    height: 24px;
    background: var(--brand-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.product-image {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #6c757d;
}

.product-info h3 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.product-info p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.product-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.spec-label {
    color: #6c757d;
}

.spec-value {
    color: #333;
    font-weight: 500;
}

/* Enhanced Room Visualization */
.room-visualization-container {
    width: 100%;
    /* Removed: min-height, display flex, align-items, justify-content */
    /* Matches preview-details styling */
}

.room-visualization {
    width: 100% !important;
    max-width: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Light Point Styles */
.light-point {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #FFD700 0%, #FFA500 100%);
    border: 3px solid var(--brand-color);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 24px rgba(255, 215, 0, 0.4);
    z-index: 10;
    animation: lightPulse 2s ease-in-out infinite alternate;
}

@keyframes lightPulse {
    from { 
        box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 24px rgba(255, 215, 0, 0.4);
        transform: scale(1);
    }
    to { 
        box-shadow: 0 0 16px rgba(255, 215, 0, 1), 0 0 32px rgba(255, 215, 0, 0.6);
        transform: scale(1.05);
    }
}

/* Enhanced Room Outline */
.room-outline {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 3px solid var(--brand-color);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    overflow: visible;
}

/* Directional Arrow Styles */
.directional-arrow {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-color), #FF6B6B);
    z-index: 5;
}

.directional-arrow::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--brand-color);
}

/* Distance Label Styles */
.distance-label {
    position: absolute;
    font-size: 10px;
    color: var(--brand-color);
    font-weight: bold;
    background: rgba(255,255,255,0.9);
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid var(--brand-color);
    z-index: 15;
    white-space: nowrap;
}

/* Enhanced Measurement Legend */
.measurement-legend {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid var(--brand-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.measurement-item {
    transition: transform 0.3s ease;
}

.measurement-item:hover {
    transform: translateY(-2px);
}

.measurement-icon {
    transition: all 0.3s ease;
}

.measurement-icon:hover {
    transform: scale(1.1);
}

/* Spacing Details Enhancement */
.spacing-detail {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid var(--brand-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.spacing-detail:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.room-visualization svg {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 300px;
}

/* Preview Details */
.preview-details {
    height: fit-content;
}

.summary-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.summary-item:last-child {
    border-bottom: none;
}

/* Final Plan Styles */
.plan-document {
    overflow: hidden;
}

.plan-header {
    background: linear-gradient(135deg, var(--brand-color) 0%, var(--brand-color-dark) 100%);
}

.plan-logo {
    height: 50px;
    width: auto;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.spec-item-final {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.spec-item-final .label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
    display: block;
}

.spec-item-final .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.product-details {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.product-details .product-image {
    width: 80px;
    height: 80px;
    margin-bottom: 0;
}

.product-details-info h5 {
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.product-details-info p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.layout-visualization {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
}

.tech-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.tech-spec-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--brand-color);
}

.tech-spec-item h5 {
    color: var(--brand-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.tech-spec-item p {
    color: #6c757d;
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Footer */
.wizard-footer {
    position: sticky;
    bottom: 0;
    z-index: 1000;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

/* Responsive Design */
@media (max-width: 768px) {
    .step-indicators {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .step-indicator {
        flex: 1;
        min-width: 80px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .wizard-content {
        padding: 1rem 0;
    }
    
    .plan-content {
        padding: 1rem !important;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    .tech-specs {
        grid-template-columns: 1fr;
    }
    
    .product-details {
        flex-direction: column;
        text-align: center;
    }
    
    /* Light distribution plan responsive adjustments */
    .room-visualization-container {
        padding: 1rem;
        min-height: 400px;
    }
    
    .room-outline {
        height: 350px !important;
        margin: 10px !important;
    }
    
    .room-layout {
        height: 300px !important;
        margin: 10px !important;
    }
    
    .light-point {
        width: 12px !important;
        height: 12px !important;
        border-width: 2px !important;
    }
    
    .distance-label {
        font-size: 8px !important;
        padding: 1px 2px !important;
    }
    
    .summary-item {
        padding: 0.5rem 0;
    }
    
    .preview-details {
        margin-top: 1rem !important;
    }
}

/* Tablet specific styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .room-visualization-container {
        padding: 1.5rem;
        min-height: 450px;
    }
    
    .room-outline {
        height: 400px !important;
        margin: 15px !important;
    }
    
    .room-layout {
        height: 350px !important;
        margin: 15px !important;
    }
    
    .light-point {
        width: 14px !important;
        height: 14px !important;
    }
    
    .distance-label {
        font-size: 9px !important;
        padding: 2px 3px !important;
    }
}

@media (max-width: 480px) {
    .step-header h2 {
        font-size: 1.5rem;
    }
    
    .step-header p {
        font-size: 1rem;
    }
    
    .product-card {
        padding: 1rem;
    }
    
    .product-image {
        height: 150px;
    }
    
    .wizard-footer .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Mobile specific light distribution adjustments */
    .room-visualization-container {
        padding: 0.5rem;
        min-height: 300px;
    }
    
    .room-outline {
        height: 250px !important;
        margin: 5px !important;
    }
    
    .room-layout {
        height: 200px !important;
        margin: 5px !important;
    }
    
    .light-point {
        width: 10px !important;
        height: 10px !important;
        border-width: 1px !important;
    }
    
    .distance-label {
        font-size: 7px !important;
        padding: 1px !important;
    }
    
    .summary-item {
        padding: 0.25rem 0;
        font-size: 0.8rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--brand-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-color-dark);
}

/* RTL Specific Adjustments */
[dir="rtl"] .step-indicator.completed .step-number {
    background: #28a745;
}

[dir="rtl"] .product-card.selected::before {
    left: 1rem;
    right: auto;
}

[dir="rtl"] .tech-spec-item {
    border-left: none;
    border-right: 4px solid var(--brand-color);
}

/* Animation for room visualization */
.room-visualization svg {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 300px;
}

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-color-rgb), 0.25);
}

/* Print styles */
@media print {
    .wizard-header,
    .wizard-footer,
    .loading-overlay {
        display: none !important;
    }
    
    .wizard-container {
        box-shadow: none;
    }
    
    .plan-document {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Livewire specific styles */
[wire\:loading] {
    opacity: 0.5;
    pointer-events: none;
}

[wire\:loading\.delay] {
    opacity: 0.5;
    pointer-events: none;
}

[wire\:offline] {
    opacity: 0.5;
    pointer-events: none;
}

[wire\:dirty] {
    border-color: var(--brand-color);
}

/* Enhanced Room Visualization - Full Container Fill */
.room-visualization-container {
    width: 100%;
    max-width: 100%;
}

.room-outline,
.room-layout {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Responsive Design for Room Visualization */
@media (max-width: 1024px) {
    .room-outline,
    .room-layout {
        height: 450px !important;
    }
}

@media (max-width: 768px) {
    .room-outline,
    .room-layout {
        height: 400px !important;
    }
    
    .room-outline .light-point,
    .room-layout .light-point {
        width: 12px !important;
        height: 12px !important;
        border-width: 2px !important;
    }
    
    /* Smaller labels on mobile */
    .room-outline div[style*="font-size: 12px"],
    .room-layout div[style*="font-size: 11px"] {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }
    
    .room-outline div[style*="font-size: 10px"],
    .room-layout div[style*="font-size: 9px"] {
        font-size: 8px !important;
    }
}

@media (max-width: 480px) {
    .room-outline,
    .room-layout {
        height: 350px !important;
        border-width: 2px !important;
    }
    
    .room-outline .light-point,
    .room-layout .light-point {
        width: 10px !important;
        height: 10px !important;
        border-width: 1px !important;
    }
}

/* Print optimization */
@media print {
    .room-outline,
    .room-layout {
        width: 100% !important;
        max-width: 100% !important;
        height: 500px !important;
        page-break-inside: avoid;
    }
}

/* New Flow Styles */
.room-type-card:hover, .ceiling-option:hover, .gypsum-option:hover, .layout-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.room-type-card.selected, .ceiling-option.selected, .gypsum-option.selected, .layout-option.selected {
    background-color: rgba(164, 42, 43, 0.05);
    border-color: #A42A2B !important;
}

.room-type-card, .ceiling-option, .gypsum-option, .layout-option {
    transition: all 0.3s ease;
    background-color: #fff;
}

.room-type-card:hover, .ceiling-option:hover, .gypsum-option:hover, .layout-option:hover {
    background-color: #f8f9fa;
}
