/* Dashboard Page Styles */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #111827;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Main Dashboard Content */
.dashboard-main {
    flex: 1;
    padding: 0;
    margin-top: var(--header-height, 64px);
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.dashboard-title i {
    color: #3b82f6;
    font-size: 1.5rem;
}

.dashboard-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Enhanced Stats Section */
.stats-section {
    margin-bottom: 2rem;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.widget-config-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: white;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.widget-config-btn:hover {
    background: #3b82f6;
    color: white;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Smaller Quick Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 80px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.1), 0 4px 6px 0 rgba(0, 0, 0, 0.05);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    line-height: 1.2;
}

/* Modules Section */
.modules-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
}

/* Smaller Modules Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.module-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 140px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.1), 0 4px 6px 0 rgba(0, 0, 0, 0.05);
    border-color: #e5e7eb;
    text-decoration: none;
    color: inherit;
}

.module-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    text-decoration: none;
    color: inherit;
}

.module-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #3b82f6;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.module-card:hover .module-icon {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    transform: scale(1.05);
}

.module-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.module-description {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    flex: 1;
}

.module-arrow {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    transition: var(--transition);
    opacity: 0;
}

.module-card:hover .module-arrow {
    opacity: 1;
    background: rgba(255, 255, 255, 0.9);
    color: #3b82f6;
    transform: translateX(2px);
}

/* Widget Configuration Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    overflow-y: auto;
    padding: 2rem;
    box-sizing: border-box;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    z-index: 10000;
    margin: 0 auto;
    max-width: 800px;
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h2 i {
    color: #3b82f6;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-body {
    padding: 1.5rem 2rem;
    max-height: calc(80vh - 160px);
    overflow-y: auto;
}

.modal-description {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.preset-section {
    margin-bottom: 2rem;
}

.preset-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.preset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.preset-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.preset-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

.widget-selection h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.widget-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.widget-option {
    position: relative;
    cursor: pointer;
}

.widget-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.widget-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.widget-preview i {
    font-size: 1.1rem;
    color: #6b7280;
    width: 20px;
    text-align: center;
}

.widget-option input:checked + .widget-preview {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.widget-option input:checked + .widget-preview i {
    color: #3b82f6;
}

.widget-option:hover .widget-preview {
    border-color: #3b82f6;
    background: #f8fafc;
}

.selection-info {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    font-weight: 500;
    color: #374151;
}

.modal-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 2px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

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

.btn.primary {
    background: #3b82f6;
    color: white;
}

.btn.primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn.secondary {
    background: white;
    color: #374151;
    border: 2px solid #e2e8f0;
}

.btn.secondary:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
}

    .modules-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

    .widget-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

    .preset-buttons {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        min-height: 70px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .modules-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
    }
    
    .module-card {
        min-height: 120px;
        padding: 1rem;
    }
    
    .module-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    
    .module-arrow {
        display: none;
    }
    
    .widget-config-btn {
        width: 32px;
        height: 32px;
    }
    
    .modal {
        padding: 1rem;
    }

    .modal-content {
        max-width: none;
        margin: 0;
    }
    
    .widget-options-grid {
        grid-template-columns: 1fr;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 0.75rem;
    }
    
    .dashboard-title {
        font-size: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .dashboard-subtitle {
        font-size: 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 0.75rem;
        min-height: 65px;
    }
    
    .module-card {
        min-height: 110px;
        padding: 0.875rem;
    }
    
    .module-title {
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.125rem;
    }
    
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .widget-config-btn {
        align-self: flex-end;
    }
}

/* Loading States */
.dashboard-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6b7280;
    }

.dashboard-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Print Styles */
@media print {
    .dashboard-main {
        margin-top: 0;
    }
    
    .stats-grid,
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .module-card,
    .stat-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .module-arrow {
        display: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .module-card,
    .stat-card {
        border: 2px solid #000000;
    }
    
    .module-icon,
    .stat-icon {
        background: #000000;
        color: #ffffff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .module-card,
    .stat-card,
    .module-icon,
    .module-arrow {
        transition: none;
    }
    
    .module-card:hover,
    .stat-card:hover {
        transform: none;
    }
    
    .dashboard-loading i {
        animation: none;
    }
}
