/**
 * Marketing Research Control Panel - Styles
 *
 * @author Roberto Ocampo <rocampo@ocampo.ai>
 * @version 1.0.0
 * @date 2026-01-25
 */

/* =============================================================================
   Layout
   ============================================================================= */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

.container-fluid {
    overflow-x: hidden;
    max-width: 100vw;
    padding-right: 0;
}

.container-fluid > .row {
    margin-right: 0;
    margin-left: 0;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    min-height: 100vh;
    width: 220px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .sidebar {
        width: 220px;
    }
}

@media (min-width: 992px) {
    .sidebar {
        width: 220px;
    }
}

/* Sidebar inner structure */
.sidebar .position-sticky {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
    padding-bottom: 100px;
}

.sidebar .nav-link {
    font-weight: 500;
    padding: .5rem 1rem;
    color: rgba(255, 255, 255, .65);
    border-radius: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, .1);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, .15);
}

/* Sidebar bottom info */
.sidebar-info {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    background: rgba(0, 0, 0, .2);
}

.sidebar-info small {
    display: block;
    line-height: 1.6;
}

main,
.main-content {
    padding-top: 1rem;
    margin-left: 220px;
    padding-right: 1rem;
    max-width: calc(100vw - 220px);
    width: calc(100% - 220px);
    box-sizing: border-box;
}

/* =============================================================================
   Cards
   ============================================================================= */

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.template-card {
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
}

.template-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================================================
   Forms
   ============================================================================= */

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

#researchBrief {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 400px;
}

/* =============================================================================
   Report Styles
   ============================================================================= */

.market-research-report {
    font-size: 0.9rem;
    line-height: 1.6;
}

.market-research-report .report-header {
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 1rem;
}

.market-research-report .report-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.market-research-report .report-section {
    margin-bottom: 1.5rem;
}

.market-research-report .report-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.market-research-report .report-section h6 {
    font-weight: 600;
    color: #6c757d;
}

.market-research-report table {
    font-size: 0.85rem;
}

.market-research-report table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.market-research-report .report-footer {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Summary Tables */
.summary-table {
    margin-bottom: 1.5rem;
}

.summary-table .table-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
}

/* =============================================================================
   Loading States
   ============================================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#loadingProgress {
    transition: width 0.3s ease;
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .sidebar,
    .btn-toolbar,
    #studyForm,
    .card-header,
    #reportActions {
        display: none !important;
    }

    main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .market-research-report {
        font-size: 11pt;
    }

    .market-research-report table {
        page-break-inside: avoid;
    }
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 767.98px) {
    .sidebar {
        position: relative;
        min-height: auto;
        padding: 0;
        width: 100%;
    }

    .sidebar.collapse:not(.show) {
        display: none;
    }

    .sidebar .position-sticky {
        min-height: auto;
        padding-bottom: 1rem;
    }

    .sidebar-info {
        position: relative;
    }

    main,
    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .platform-footer {
        margin-left: 0;
        padding: 1rem;
        max-width: 100%;
        width: 100%;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-info {
        flex-direction: column;
    }

    #researchBrief {
        min-height: 250px;
    }
}

/* =============================================================================
   Utilities
   ============================================================================= */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}

/* Status indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-indicator.active {
    background-color: #198754;
}

.status-indicator.inactive {
    background-color: #dc3545;
}

.status-indicator.pending {
    background-color: #ffc107;
}

/* Data source badges */
.source-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    background-color: #e9ecef;
    color: #495057;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* =============================================================================
   Footer - Simple Style (matching AgriData AI)
   ============================================================================= */

.platform-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    margin-top: 2rem;
    margin-left: 220px;
    max-width: calc(100vw - 220px);
    width: calc(100% - 220px);
    box-sizing: border-box;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    color: #198754;
    font-weight: 600;
    font-size: 0.9rem;
}

.footer-brand i {
    margin-right: 0.5rem;
}

.footer-info {
    display: flex;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.85rem;
}

.footer-info a {
    color: #198754;
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #495057;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #198754;
}

.footer-links a i {
    margin-left: 0.25rem;
}
