/* Reset and Base Styles */
:root {
    --primary-color: #1a3a5f;
    --secondary-color: #2a9d8f;
    --accent-color: #ff8800;
    --error-color: #FF4B4B;
    --success-color: #4CAF50;
    --border-color: #E5E7EB;
    --background-color: #F9FAFB;
    --text-color: #333;
    --secondary-text: #666;
    --header-height: 60px;
    --panel-header-height: 50px;
    --sidebar-width: 320px;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header Styles */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: var(--header-height);
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
}

.logo-image {
    height: 40px;
    width: 40px;
    margin-right: 10px;
    object-fit: contain;
}

.logo-text {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.5px;
}

.main-nav {
    display: flex;
    align-items: center;
}

.auth-buttons {
    display: flex;
    gap: 12px;
}

.btn-login, .btn-connexion {
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-login:hover, .btn-connexion:hover {
    background-color: rgba(26, 58, 95, 0.1);
}

.btn-register, .btn-inscription {
    padding: 8px 16px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-register:hover, .btn-inscription:hover {
    background-color: #14304d;
}

.user-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-dropdown {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.user-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    display: none;
    z-index: 10;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Page Title */
.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title a {
    font-size: 14px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* New App Container Layout */
.app-container {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(400px, 2fr) minmax(250px, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
    height: calc(100vh - var(--header-height) - 40px);
    overflow: hidden;
}

/* Panel Styles */
.input-panel, .analysis-dashboard, .neighborhood-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: var(--panel-header-height);
    border-bottom: 1px solid var(--border-color);
    background-color: #f8f9fa;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.panel-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--secondary-text);
    transition: all 0.2s;
}

.panel-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.panel-toggle svg {
    transition: transform 0.2s;
}

.panel-toggle.collapsed svg {
    transform: rotate(180deg);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.panel-content.collapsed {
    display: none;
}

/* Form Styles */
.main-form {
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    color: #4B5563;
    font-weight: 500;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 58, 95, 0.1);
}

.description-container {
    position: relative;
    margin-bottom: 32px;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.char-counter {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 12px;
    color: var(--secondary-text);
}

/* Media Upload Zone */
.media-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.media-upload-zone:hover {
    border-color: var(--secondary-color);
    background-color: rgba(42, 157, 143, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--secondary-text);
}

.upload-placeholder svg {
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.upload-link {
    color: var(--secondary-color);
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

.upload-note {
    font-size: 12px;
    color: var(--secondary-text);
    margin-top: 5px;
}

.hidden-upload {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

/* Button Styles */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.btn-optimize {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-optimize:hover {
    background-color: #14304d;
}

.btn-reset {
    padding: 12px 24px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--secondary-text);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background-color: #f5f5f5;
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s infinite linear;
}

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

/* Progress Indicator */
.progress-container {
    margin-bottom: 20px;
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.progress-step::before {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(-50% + 15px);
    width: calc(100% - 30px);
    height: 2px;
    background-color: var(--border-color);
    z-index: 0;
}

.progress-step:first-child::before {
    display: none;
}

.progress-step.active .step-number {
    background-color: var(--primary-color);
    color: white;
}

.progress-step.completed .step-number {
    background-color: var(--success-color);
    color: white;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #f1f2f6;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    z-index: 1;
    margin-bottom: 8px;
}

.step-label {
    font-size: 12px;
    color: var(--secondary-text);
    font-weight: 500;
}

.progress-step.active .step-label {
    color: var(--primary-color);
}

.progress-bar {
    height: 6px;
    background-color: #f1f2f6;
    border-radius: 3px;
    overflow: hidden;
}

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

/* Analysis Grid */
.analysis-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    height: calc(100% - 100px);
}

.analysis-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.analysis-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Score Badges */
.score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.score-badges {
    display: flex;
    gap: 8px;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 60px;
}

.score-badge.initial {
    background-color: rgba(236, 236, 236, 0.8);
    color: #666;
    border: 1px dashed #ccc;
}

.score-badge.optimized {
    background-color: rgba(42, 157, 143, 0.1);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.score-badge.score-low {
    background-color: rgba(244, 67, 54, 0.1);
    color: #e53935;
    border-color: #e53935;
}

.score-badge.score-medium {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffa000;
    border-color: #ffa000;
}

.score-badge.score-high {
    background-color: rgba(42, 157, 143, 0.1);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.score-badge.initial.score-low {
    background-color: rgba(244, 67, 54, 0.05);
    color: #e53935;
    border-color: #e53935;
}

.score-badge.initial.score-medium {
    background-color: rgba(255, 193, 7, 0.05);
    color: #ffa000;
    border-color: #ffa000;
}

.score-badge.initial.score-high {
    background-color: rgba(42, 157, 143, 0.05);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Score Circle */
.score-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--border-color);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin: 20px auto;
}

.score-circle.optimized {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background-color: transparent !important;
}

/* Analysis Lists */
.analysis-list {
    text-align: left;
    margin-top: 20px;
}

.analysis-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
}

.analysis-item.good {
    background-color: rgba(42, 157, 143, 0.1);
    color: #1e7d73;
}

.analysis-item.warning {
    background-color: rgba(255, 136, 0, 0.1);
    color: #d97706;
}

.analysis-item.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

.analysis-item svg {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Optimized Content */
.optimized-content {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-action:hover {
    background-color: #f5f5f5;
}

.btn-save {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    padding: 8px 12px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-save:hover {
    background-color: #14304d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-save:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Neighborhood Panel */
.neighborhood-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--secondary-text);
    text-align: center;
    padding: 20px;
}

.neighborhood-placeholder svg {
    color: #e0e0e0;
    margin-bottom: 16px;
}

/* Neighborhood Information Section */
.neighborhood-info {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.neighborhood-info-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.neighborhood-info h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 16px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.neighborhood-info h5 {
    color: #555;
    margin-bottom: 8px;
    font-size: 14px;
}

.neighborhood-name {
    font-weight: 600;
    color: #444;
    font-size: 16px;
}

.neighborhood-description {
    color: #666;
    line-height: 1.5;
    font-size: 14px;
}

.amenities-section, .price-section {
    background-color: #fff;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #eee;
}

.amenities-list, .price-details {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.amenities-list li, .price-details li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.amenities-list li:last-child, .price-details li:last-child {
    border-bottom: none;
}

.neighborhood-note {
    font-style: italic;
    color: #888;
    font-size: 12px;
    margin-top: 10px;
}

/* Rich Text Editor */
.editor-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    height: 70%;
    max-height: 600px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.editor-header h3 {
    font-size: 18px;
    color: var(--primary-color);
}

.editor-actions {
    display: flex;
    gap: 8px;
}

#richTextEditor {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Price Gauge */
.price-gauge {
    margin: 20px 0;
    position: relative;
    height: 40px;
}

.price-gauge-bar {
    height: 8px;
    background: linear-gradient(to right, #4CAF50, #FFC107, #FF5722);
    border-radius: 4px;
    position: relative;
}

.price-marker {
    position: absolute;
    top: -15px;
    transform: translateX(-50%);
    width: 2px;
    height: 38px;
    background-color: #333;
}

.price-marker::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background-color: #333;
    border-radius: 50%;
}

.price-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: var(--secondary-text);
}

.price-value {
    position: absolute;
    top: -30px;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
}

/* Footer */
.main-footer {
    background-color: white;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 11px;
    margin-top: auto;
}

/* Error Handling */
.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 4px;
}

.form-input.error {
    border-color: var(--error-color);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
    max-width: 300px;
}

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

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

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

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

/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr 2fr;
    }
    
    .neighborhood-panel {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .analysis-grid {
        height: auto;
    }
    
    .main-header {
        flex-direction: column;
        height: auto;
        padding: 16px;
    }
    
    .logo-container {
        margin-bottom: 16px;
    }
    
    .input-panel, .analysis-dashboard, .neighborhood-panel {
        height: auto;
        margin-bottom: 20px;
    }
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #f5f6fc;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-title {
    font-size: 14px;
    color: var(--secondary-text);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-color);
}
