/* Dashboard Insights Specific Styles */

/* CSS Reset and Base Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000000;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container Layout */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar - Updated to match Invoice structure */
.sidebar {
    width: 220px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    padding: 1.5rem 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 100;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Logo section - Updated to match Invoice */
.logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    letter-spacing: -1px;
    margin-bottom: 0;
}

/* Navigation container - Updated to match Invoice */
.nav-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 1rem;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    text-decoration: none;
    color: #000000;
    width: 100%;
    box-sizing: border-box;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-left-color: #000000;
    transform: translateX(5px);
    text-decoration: none;
}

.nav-item.active .nav-link {
    background-color: rgba(0, 0, 0, 0.15);
    border-left-color: #000000;
    transform: translateX(5px);
}

.nav-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
    color: #000000;
    transition: transform 0.15s ease;
}

.nav-text {
    font-size: 1rem;
    font-weight: 500;
    color: #000000;
    transition: color 0.15s ease;
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    background-color: #000000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #333333;
}

.header-content h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    color: #cccccc;
    font-size: 1rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background-color: #333333;
    color: #ffffff;
    border: 1px solid #555555;
}

.btn-secondary:hover {
    background-color: #444444;
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1rem;
}

/* Insights Overview Cards */
.insights-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.overview-card {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #333333;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.overview-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.overview-card.critical .overview-icon {
    background: rgba(231, 76, 60, 0.2);
}

.overview-card.opportunity .overview-icon {
    background: rgba(46, 204, 113, 0.2);
}

.overview-card.trend .overview-icon {
    background: rgba(52, 152, 219, 0.2);
}

.overview-card.performance .overview-icon {
    background: rgba(241, 196, 15, 0.2);
}

.overview-content h3 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.overview-content p {
    color: #cccccc;
    font-size: 0.9rem;
    margin: 0.25rem 0 0 0;
}

/* Filter Section */
.filter-section {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #333333;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    color: #cccccc;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-select {
    padding: 0.5rem 1rem;
    background-color: #333333;
    color: #ffffff;
    border: 1px solid #555555;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* AI Summary Section */
.ai-summary-section {
    margin-bottom: 2rem;
}

.ai-summary-card {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 12px;
    border: 1px solid #333333;
    overflow: hidden;
}

.ai-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #333333;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.ai-summary-header h3 {
    color: #ffffff;
    font-size: 1.2rem;
    margin: 0;
}

.update-time {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
}

.ai-summary-content {
    padding: 1.5rem;
}

.ai-summary-content p {
    color: #cccccc;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.ai-recommendations {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.recommendation-tag {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.recommendation-tag.positive {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.recommendation-tag.negative {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.recommendation-tag.warning {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid #f1c40f;
}

/* Insights Sections */
.insights-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.insights-section {
    background-color: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #333333;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #333333;
    background-color: #2a2a2a;
}

.section-header h3 {
    color: #ffffff;
    font-size: 1.3rem;
    margin: 0;
}

.section-toggle {
    background: none;
    border: 1px solid #555555;
    color: #cccccc;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.section-toggle:hover {
    background-color: #333333;
}

/* Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.insight-card {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #333333;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #667eea, #764ba2);
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    border-color: #555555;
}

.insight-card.critical::before {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
}

.insight-card.opportunity::before {
    background: linear-gradient(180deg, #2ecc71, #27ae60);
}

.insight-card.trend::before {
    background: linear-gradient(180deg, #3498db, #2980b9);
}

.insight-card.operational::before {
    background: linear-gradient(180deg, #9b59b6, #8e44ad);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.insight-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background-color: #333333;
}

.insight-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.insight-category {
    color: #888888;
    font-size: 0.8rem;
    margin: 0;
}

.insight-content {
    margin-bottom: 1rem;
}

.insight-description {
    color: #cccccc;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.insight-metrics {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric {
    background-color: #333333;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-align: center;
}

.metric-value {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
}

.metric-label {
    color: #888888;
    font-size: 0.8rem;
}

.insight-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.insight-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.insight-priority.critical {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.insight-priority.high {
    background: rgba(230, 126, 34, 0.2);
    color: #e67e22;
}

.insight-priority.medium {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.insight-priority.low {
    background: rgba(149, 165, 166, 0.2);
    color: #95a5a6;
}

.insight-timestamp {
    color: #888888;
    font-size: 0.8rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

.modal-content {
    background-color: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #333333;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #333333;
    background-color: #2a2a2a;
}

.modal-header h3 {
    color: #ffffff;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #cccccc;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.insight-detail {
    display: flex;
    gap: 1rem;
}

.detail-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: #333333;
    flex-shrink: 0;
}

.detail-content h4 {
    color: #ffffff;
    font-size: 1.3rem;
    margin: 0 0 1rem 0;
}

.detail-content p {
    color: #cccccc;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-recommendations {
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.detail-recommendations h5 {
    color: #ffffff;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.detail-recommendations ul {
    color: #cccccc;
    margin: 0;
    padding-left: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #333333;
    background-color: #2a2a2a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        overflow-x: auto;
        padding: 1rem 0;
    }

    .nav-menu {
        display: flex;
        white-space: nowrap;
        padding: 0 1rem;
        gap: 0.25rem;
    }

    .nav-item {
        flex-direction: column;
        padding: 0.5rem;
        min-width: 80px;
        text-align: center;
        border-left: none;
        border-bottom: 4px solid transparent;
    }

    .nav-item:hover,
    .nav-item.active {
        border-left: none;
        border-bottom-color: #000000;
        transform: translateY(-3px);
    }

    .nav-icon {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .nav-text {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .insights-overview {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .header-actions {
        justify-content: center;
    }
}

/* Animation for section toggles */
.insights-grid.hidden {
    display: none;
}

.section-toggle.collapsed::after {
    content: ' ↓';
}

.section-toggle.expanded::after {
    content: ' ↑';
}

/* Loading states */
.insight-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.insight-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #333333;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Alert styles */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 500;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
}

.alert-success {
    background-color: #27ae60;
    border: 1px solid #2ecc71;
}

.alert-error {
    background-color: #c0392b;
    border: 1px solid #e74c3c;
}

.alert-warning {
    background-color: #d68910;
    border: 1px solid #f1c40f;
}

.alert-info {
    background-color: #2980b9;
    border: 1px solid #3498db;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}