/* Sweet Home - CSS Styles */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand i {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 5px;
    margin-left: 40px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-links a.active {
    background: var(--primary-color);
    color: white;
}

.nav-actions {
    margin-left: auto;
}

/* Container */
.container {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-icon {
    background: transparent;
    padding: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-card i {
    font-size: 32px;
    color: var(--primary-color);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.dashboard-section {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
}

/* Room Cards */
.room-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.room-card:hover {
    background: var(--bg-tertiary);
}

.room-name {
    font-weight: 500;
}

.room-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Rooms Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.room-card-large {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 20px;
}

.room-card-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.room-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.room-details h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.room-meta {
    display: flex;
    gap: 10px;
}

/* Decision Cards */
.decision-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.decision-card {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.decision-card:hover {
    background: var(--bg-tertiary);
}

.decision-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.decision-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Decisions List */
.decisions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.decision-card-large {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.decision-card-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.decision-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.decision-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.decision-arrow {
    color: var(--text-secondary);
}

/* Badges */
.status-badge, .priority-badge, .impact-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-planning { background: #e3f2fd; color: #1565c0; }
.status-in_progress, .status-in-progress { background: #fff3e0; color: #ef6c00; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-proposed { background: #e3f2fd; color: #1565c0; }
.status-approved { background: #e8f5e9; color: #2e7d32; }
.status-rejected { background: #ffebee; color: #c62828; }

.priority-high { background: #ffebee; color: #c62828; }
.priority-medium { background: #fff3e0; color: #ef6c00; }
.priority-low { background: #e8f5e9; color: #2e7d32; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.empty-state h2 {
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Quick Actions */
.quick-actions {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.quick-actions h2 {
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Document View */
.document-view {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.document-meta {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.file-path {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
}

.document-content {
    padding: 30px;
    line-height: 1.8;
}

.document-content h1, .document-content h2, .document-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
}

.document-content p {
    margin-bottom: 16px;
}

.document-content ul, .document-content ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.document-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

.document-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}

.document-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.document-content th, .document-content td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.document-content th {
    background: var(--bg-secondary);
}

/* Editor */
.editor-toolbar {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.toolbar-spacer {
    flex: 1;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    margin-bottom: 15px;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.error-page h1 {
    font-size: 72px;
    font-weight: 700;
    margin-bottom: 10px;
}

.error-page h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 15px;
    }
    
    .nav-links {
        display: none;
    }
    
    .container {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .rooms-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

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

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* RTL Support */
[dir="rtl"] .nav-links {
    margin-left: 0;
    margin-right: 40px;
}

[dir="rtl"] .nav-actions {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .document-content ul,
[dir="rtl"] .document-content ol {
    margin-left: 0;
    margin-right: 24px;
}

[dir="rtl"] .page-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .decision-card-large {
    flex-direction: row-reverse;
}

[dir="rtl"] .decision-arrow {
    transform: scaleX(-1);
}

[dir="rtl"] .decision-meta {
    flex-direction: row-reverse;
}

/* Bidirectional text support */
[dir="rtl"] .document-content code {
    direction: ltr;
    unicode-bidi: bidi-override;
}

[dir="rtl"] .file-path {
    direction: ltr;
    unicode-bidi: bidi-override;
}

[dir="rtl"] .nav-brand a {
    flex-direction: row-reverse;
}

/* Task Cards */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.task-card:hover {
    background: var(--bg-tertiary);
}

.task-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.task-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
}

/* Budget Summary */
.budget-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.budget-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.budget-value {
    font-weight: 600;
    font-size: 16px;
}

.budget-progress {
    margin-top: 10px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

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

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    display: block;
}

/* Timeline */
.timeline-view {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.timeline-phase {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    position: relative;
}

.timeline-phase::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 30px;
    bottom: -20px;
    width: 2px;
    background: var(--border-color);
}

.timeline-phase:last-child::before {
    display: none;
}

.timeline-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.timeline-marker.active {
    background: var(--primary-color);
    color: white;
}

.timeline-marker.completed {
    background: var(--success-color);
    color: white;
}

.timeline-content {
    flex: 1;
}

.timeline-content h3 {
    margin-bottom: 5px;
    font-size: 16px;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* AI Review Styles */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

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

.review-header {
    margin-bottom: 15px;
}

.review-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.review-meta i {
    margin-left: 4px;
}

.review-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.review-status.status-new { background: #e3f2fd; color: #1565c0; }
.review-status.status-accepted { background: #e8f5e9; color: #2e7d32; }
.review-status.status-rejected { background: #ffebee; color: #c62828; }
.review-status.status-implemented { background: #f3e5f5; color: #7b1fa2; }

.review-body {
    margin-bottom: 15px;
}

.review-summary {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.review-footer {
    display: flex;
    gap: 10px;
}

/* AI Review Detail */
.review-detail {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.review-meta-bar {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 14px;
}

.review-summary-inline {
    margin-right: auto;
    font-weight: 500;
}

.review-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.stat-box {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

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

.stat-high .stat-number { color: #c62828; }
.stat-rec .stat-number { color: #1565c0; }
.stat-wrn .stat-number { color: #ef6c00; }
.stat-qst .stat-number { color: #7b1fa2; }
.stat-act .stat-number { color: #2e7d32; }

/* Tabs */
.review-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Review Items */
.review-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    border-right: 4px solid var(--border-color);
}

.review-item.item-rec { border-right-color: #1565c0; }
.review-item.item-wrn { border-right-color: #ef6c00; }
.review-item.item-qst { border-right-color: #7b1fa2; }
.review-item.item-act { border-right-color: #2e7d32; }

.review-item.priority-high {
    background: #fff8f8;
}

.item-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.item-id {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-secondary);
    direction: ltr;
}

.item-category {
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 12px;
}

.item-priority {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.item-priority.priority-high { background: #ffebee; color: #c62828; }
.item-priority.priority-medium { background: #fff3e0; color: #ef6c00; }
.item-priority.priority-low { background: #e8f5e9; color: #2e7d32; }

.item-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.item-status.status-new { background: #e3f2fd; color: #1565c0; }
.item-status.status-accepted { background: #e8f5e9; color: #2e7d32; }
.item-status.status-rejected { background: #ffebee; color: #c62828; }
.item-status.status-implemented { background: #f3e5f5; color: #7b1fa2; }

.item-title {
    font-size: 16px;
    margin-bottom: 10px;
}

.item-explanation {
    line-height: 1.7;
    color: var(--text-primary);
}

.item-tradeoffs {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.item-tradeoffs strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 13px;
}

.item-tradeoffs p {
    font-size: 14px;
    line-height: 1.6;
}

.item-references {
    margin-top: 12px;
}

.item-references strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 13px;
}

.item-references ul {
    list-style: none;
    padding: 0;
}

.item-references li {
    font-size: 13px;
    font-family: monospace;
    direction: ltr;
    display: inline-block;
}

.item-references li a {
    color: var(--primary-color);
    text-decoration: none;
}

.item-references li a:hover {
    text-decoration: underline;
}

/* Empty Tab */
.empty-tab {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-tab i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Review Prose */
.review-prose {
    line-height: 1.8;
    white-space: pre-wrap;
}

/* RTL Support for AI Reviews */
[dir="rtl"] .review-meta-bar {
    flex-direction: row-reverse;
}

[dir="rtl"] .review-summary-inline {
    margin-right: 0;
    margin-left: auto;
}

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

[dir="rtl"] .review-item.item-rec { border-left-color: #1565c0; }
[dir="rtl"] .review-item.item-wrn { border-left-color: #ef6c00; }
[dir="rtl"] .review-item.item-qst { border-left-color: #7b1fa2; }
[dir="rtl"] .review-item.item-act { border-left-color: #2e7d32; }

[dir="rtl"] .item-references li {
    direction: ltr;
    unicode-bidi: bidi-override;
}
