/* Professional Dashboard Styles */

/* CSS Variables for Professional Theme */
:root {
    --dashboard-primary: #EEC225;
    --dashboard-primary-light: rgba(238, 194, 37, 0.1);
    --dashboard-primary-dark: #d4a91a;
    --dashboard-secondary: #64748b;
    --dashboard-success: #059669;
    --dashboard-success-light: rgba(5, 150, 105, 0.1);
    --dashboard-warning: #d97706;
    --dashboard-warning-light: rgba(217, 119, 6, 0.1);
    --dashboard-info: #0891b2;
    --dashboard-info-light: rgba(8, 145, 178, 0.1);
    --dashboard-danger: #dc2626;
    --dashboard-danger-light: rgba(220, 38, 38, 0.1);
    --dashboard-dark: #1e293b;
    --dashboard-light: #f8fafc;
    --dashboard-border: #e2e8f0;
    --dashboard-text: #334155;
    --dashboard-text-muted: #64748b;
    --dashboard-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --dashboard-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --dashboard-radius: 12px;
    --dashboard-radius-lg: 16px;
}

/* Global Dashboard Enhancements */
.page-content-wrapper {
    background: linear-gradient(135deg, #fefcf3 0%, #f9f7ed 100%);
    min-height: 100vh;
}

/* Dashboard Hero Section */
.dashboard-hero {
    margin-bottom: 2rem;
}

.dashboard-welcome-card {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-primary-dark) 100%);
    border: none;
    border-radius: var(--dashboard-radius-lg);
    color: #1e293b;
    overflow: hidden;
    position: relative;
    box-shadow: var(--dashboard-shadow-lg);
}

.dashboard-welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

.dashboard-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* Metric Cards */
/* Ensure equal height and width for metric cards */
.dashboard-metrics-row {
    margin: 0 -0.5rem;
    display: flex;
    flex-wrap: wrap;
}

.dashboard-metrics-row > [class*="col-"] {
    display: flex;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
    flex: 1; /* Equal width distribution */
    min-width: 0; /* Prevent flex items from overflowing */
}

/* Ensure equal width on desktop */
@media (min-width: 768px) {
    .dashboard-metrics-row > .col-md-3 {
        flex: 0 0 25%; /* Exactly 25% width for 4 equal columns */
        max-width: 25%;
    }
}

/* Ensure equal width on mobile (2 columns) */
@media (max-width: 767px) {
    .dashboard-metrics-row > .col-6 {
        flex: 0 0 50%; /* Exactly 50% width for 2 equal columns */
        max-width: 50%;
    }
}
.dashboard-metric-card {
    border: none;
    border-radius: var(--dashboard-radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--dashboard-shadow);
    height: 200px; /* Fixed height for equal cards */
    width: 100%; /* Full width of container */
    background: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Ensure proper card backgrounds for light mode */
[data-theme=light] .dashboard-metric-card,
.dashboard-metric-card {
    background: white;
}

[data-theme=light] .dashboard-analytics-card,
.dashboard-analytics-card {
    background: white;
}

/* Dark mode card backgrounds */
[data-theme=dark] .dashboard-metric-card {
    background: #242644;
}

[data-theme=dark] .dashboard-analytics-card {
    background: #242644;
}

.dashboard-metric-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 1.25rem;
    text-align: center;
    flex: 1; /* Take up all available space */
}

.dashboard-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--dashboard-primary), var(--dashboard-primary-dark));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dashboard-metric-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--dashboard-shadow-lg);
}

.dashboard-metric-card:hover::before {
    opacity: 1;
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--dashboard-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.bg-primary-light {
    background: var(--dashboard-primary-light);
}

.bg-success-light {
    background: var(--dashboard-success-light);
}

.bg-warning-light {
    background: var(--dashboard-warning-light);
}

.bg-info-light {
    background: var(--dashboard-info-light);
}

/* Override Bootstrap icon colors with primary color scheme */
.dashboard-metric-card .text-primary {
    color: var(--dashboard-primary) !important;
}

.dashboard-metric-card .text-success {
    color: var(--dashboard-primary) !important;
}

.dashboard-metric-card .text-warning {
    color: var(--dashboard-primary) !important;
}

.dashboard-metric-card .text-info {
    color: var(--dashboard-primary) !important;
}

/* Update background colors to use primary color variations */
.dashboard-metric-card .bg-primary-light {
    background: var(--dashboard-primary-light) !important;
}

.dashboard-metric-card .bg-success-light {
    background: rgba(238, 194, 37, 0.08) !important;
}

.dashboard-metric-card .bg-warning-light {
    background: rgba(238, 194, 37, 0.12) !important;
}

.dashboard-metric-card .bg-info-light {
    background: rgba(238, 194, 37, 0.06) !important;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dashboard-dark);
    margin-bottom: 0.5rem;
    line-height: 1.1;
    flex-shrink: 0;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--dashboard-text-muted);
    font-weight: 500;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
    text-align: center;
}

/* Analytics Card */
.dashboard-analytics-card {
    border: none;
    border-radius: var(--dashboard-radius-lg);
    box-shadow: var(--dashboard-shadow-lg);
    background: white;
    overflow: hidden;
}

.dashboard-analytics-card .card-header {
    background: linear-gradient(135deg, var(--dashboard-light) 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--dashboard-border);
    border-radius: var(--dashboard-radius-lg) var(--dashboard-radius-lg) 0 0;
    padding: 2rem;
    position: relative;
}

.dashboard-analytics-card .card-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--dashboard-primary), var(--dashboard-primary-dark), var(--dashboard-success));
}

.card-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--dashboard-dark);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--dashboard-text-muted);
    margin-bottom: 0;
    margin-top: 0.25rem;
}

/* Professional Accordion */
.dashboard-accordion .accordion-item {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.dashboard-accordion .accordion-item:last-child {
    margin-bottom: 0;
}

.dashboard-accordion .accordion-button {
    background-color: #ffffff;
    border: none;
    padding: 1.25rem 1.5rem;
    font-weight: 500;
    border-radius: 12px;
}

.dashboard-accordion .accordion-button:not(.collapsed) {
    background-color: var(--dashboard-primary-light);
    color: var(--dashboard-primary-dark);
    box-shadow: none;
}

.dashboard-accordion .accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(238, 194, 37, 0.25);
}

.product-info .product-name {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0;
}

.product-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.product-quick-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stat-item {
    font-size: 0.875rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-item i {
    font-size: 0.875rem;
}

/* Analytics Table */
.analytics-table-wrapper {
    overflow-x: auto;
}

.analytics-table {
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
}

.analytics-table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    padding: 1rem;
    font-size: 0.875rem;
}

.analytics-table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.analytics-table tbody tr:last-child td {
    border-bottom: none;
}

.analytics-table tbody tr:hover {
    background-color: #f8f9fa;
}

.period-label {
    font-weight: 500;
    color: #495057;
}

.period-label i {
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

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

.metric-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Empty State */
.empty-state {
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #dee2e6;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-title {
        font-size: 1.25rem;
    }

    .dashboard-subtitle {
        font-size: 0.875rem;
    }

    .dashboard-icon {
        font-size: 2rem;
    }

    .dashboard-metric-card {
        height: 180px; /* Fixed height for mobile */
    }

    .metric-value {
        font-size: 1.6rem;
    }

    .metric-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    .product-quick-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .stat-item {
        font-size: 0.8rem;
    }

    .analytics-table {
        font-size: 0.875rem;
    }

    .analytics-table thead th,
    .analytics-table tbody td {
        padding: 0.75rem 0.5rem;
    }

    .metric-number {
        font-size: 1rem;
    }

    /* Improve mobile layout */
    .dashboard-metrics-row {
        margin: 0 -0.25rem;
    }

    .dashboard-metrics-row > [class*="col-"] {
        padding: 0 0.25rem;
        margin-bottom: 0.75rem;
    }

    .page-content-wrapper {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .dashboard-welcome-card .card-body {
        padding: 1.25rem;
    }

    .dashboard-analytics-card .card-header {
        padding: 1.25rem;
    }

    .dashboard-accordion .accordion-button {
        padding: 1rem;
    }

    .dashboard-metric-card {
        height: 160px; /* Fixed height for small mobile */
    }

    .dashboard-metric-card .card-body {
        padding: 1.25rem;
    }

    .metric-value {
        font-size: 1.4rem;
    }

    .metric-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }

    .metric-label {
        font-size: 0.7rem;
    }

    .product-info .product-name {
        font-size: 0.9rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state-icon {
        font-size: 3rem;
    }
}

/* Light Mode - Ensure proper text colors */
[data-theme=light] .metric-value,
.metric-value {
    color: var(--dashboard-dark) !important;
}

[data-theme=light] .metric-label,
.metric-label {
    color: var(--dashboard-text-muted) !important;
}

[data-theme=light] .card-title,
.card-title {
    color: var(--dashboard-dark) !important;
}

[data-theme=light] .card-subtitle,
.card-subtitle {
    color: var(--dashboard-text-muted) !important;
}

/* Ensure dashboard text is white for yellow background */
[data-theme=light] .dashboard-title,
.dashboard-title {
    color: white !important; /* White text for yellow background */
    font-weight: 600;
}

[data-theme=light] .dashboard-subtitle,
.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.9) !important; /* White text for yellow background */
}

[data-theme=light] .product-info .product-name,
.product-info .product-name {
    color: #2c3e50 !important;
}

[data-theme=light] .analytics-table thead th,
.analytics-table thead th {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

[data-theme=light] .analytics-table tbody tr:hover,
.analytics-table tbody tr:hover {
    background-color: #f8f9fa !important;
}

[data-theme=light] .analytics-table tbody td,
.analytics-table tbody td {
    color: #495057 !important;
}

[data-theme=light] .metric-number,
.metric-number {
    color: #2c3e50 !important;
}

[data-theme=light] .period-label,
.period-label {
    color: #495057 !important;
}

[data-theme=light] .stat-item,
.stat-item {
    color: #6c757d !important;
}

[data-theme=light] .empty-state-title,
.empty-state-title {
    color: #6c757d !important;
}

[data-theme=light] .empty-state-text,
.empty-state-text {
    color: #6c757d !important;
}

/* Additional light mode text fixes */
[data-theme=light] .accordion-button,
.accordion-button {
    color: #495057 !important;
}

[data-theme=light] .accordion-body,
.accordion-body {
    color: #495057 !important;
}

/* Dark Mode Support */
[data-theme=dark] .dashboard-welcome-card {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-primary-dark) 100%);
    color: #1e293b;
}

[data-theme=dark] .dashboard-title {
    color: #1e293b !important;
}

[data-theme=dark] .dashboard-subtitle {
    color: rgba(30, 41, 59, 0.8) !important;
}

[data-theme=dark] .metric-value {
    color: #e2e8f0 !important;
}

[data-theme=dark] .metric-label {
    color: #a0aec0 !important;
}

[data-theme=dark] .card-title {
    color: #e2e8f0;
}

[data-theme=dark] .card-subtitle {
    color: #a0aec0;
}

[data-theme=dark] .product-info .product-name {
    color: #e2e8f0;
}

[data-theme=dark] .analytics-table thead th {
    background-color: #2d3748;
    color: #e2e8f0;
}

[data-theme=dark] .analytics-table tbody tr:hover {
    background-color: #2d3748;
}

[data-theme=dark] .metric-number {
    color: #e2e8f0 !important;
}

[data-theme=dark] .period-label {
    color: #e2e8f0;
}

[data-theme=dark] .stat-item {
    color: #a0aec0;
}

[data-theme=dark] .text-muted {
    color: #a0aec0 !important;
}

[data-theme=dark] .empty-state-title {
    color: #a0aec0;
}

[data-theme=dark] .empty-state-text {
    color: #a0aec0;
}

/* Fallback for browsers that support prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    .dashboard-welcome-card {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }

    .metric-value {
        color: #e2e8f0 !important;
    }

    .metric-label {
        color: #a0aec0 !important;
    }

    .text-muted {
        color: #a0aec0 !important;
    }

    .card-title {
        color: #e2e8f0;
    }

    .product-info .product-name {
        color: #e2e8f0;
    }

    .analytics-table thead th {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    .analytics-table tbody tr:hover {
        background-color: #2d3748;
    }

    .metric-number {
        color: #e2e8f0 !important;
    }

    .period-label {
        color: #e2e8f0;
    }
}

/* Additional Primary Color Applications */
.btn-primary {
    background-color: var(--dashboard-primary) !important;
    border-color: var(--dashboard-primary) !important;
    color: #1e293b !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--dashboard-primary-dark) !important;
    border-color: var(--dashboard-primary-dark) !important;
    color: #1e293b !important;
}

.text-primary {
    color: var(--dashboard-primary) !important;
}

/* Links and interactive elements */
a {
    color: var(--dashboard-primary);
}

a:hover,
a:focus {
    color: var(--dashboard-primary-dark);
}

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

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

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dashboard Marketplace Section */
.dashboard-marketplace-card {
    border: none;
    border-radius: var(--dashboard-radius-lg);
    box-shadow: var(--dashboard-shadow);
    background: #ffffff;
    overflow: hidden;
}

.dashboard-marketplace-card .card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--dashboard-border);
    padding: 1.5rem;
}

.dashboard-marketplace-card .card-title {
    color: var(--dashboard-dark);
    font-weight: 600;
    font-size: 1.25rem;
}

.dashboard-marketplace-card .card-subtitle {
    color: var(--dashboard-text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.marketplace-template-card {
    background: #ffffff;
    border: 1px solid var(--dashboard-border);
    border-radius: var(--dashboard-radius);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.marketplace-template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--dashboard-shadow-lg);
    border-color: var(--dashboard-primary);
}

.template-preview-mini {
    position: relative;
    height: 120px;
    overflow: hidden;
}

.template-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.marketplace-template-card:hover .template-preview-img {
    transform: scale(1.05);
}

.template-overlay-mini {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.5rem;
}

.template-price {
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.template-info {
    padding: 1rem;
}

.template-name {
    color: var(--dashboard-dark);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.template-description {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.template-stats {
    font-size: 0.75rem;
}

.empty-marketplace {
    padding: 2rem 1rem;
}

.empty-marketplace-icon {
    font-size: 3rem;
    color: var(--dashboard-text-muted);
    opacity: 0.5;
}

.empty-marketplace-title {
    color: var(--dashboard-text);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-marketplace-text {
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-marketplace-card .card-header {
        padding: 1rem;
    }

    .dashboard-marketplace-card .card-header .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .template-preview-mini {
        height: 100px;
    }

    .template-info {
        padding: 0.75rem;
    }
}
