/* ========================================
   GLOBAL WIDGET STYLES
   Shared styles for all dashboard widgets
   
   These styles are available globally across all projects.
   Widget-specific overrides remain in scoped .razor.css files.
   ======================================== */

/* ========================================
   WIDGET SIZING CONFIGURATION
   Single Source of Truth for All Widget Sizing
   Change these variables to adjust all widget sizes globally.
   ======================================== */

:root {
    /* Widget Heights */
    --widget-size-thin-height: 100px;            /* Thin: 100px */
    --widget-size-thin-tall-height: 200px;       /* Thin-tall: 200px (2x thin) */
    --widget-size-regular-height: 200px;         /* Regular: 200px (base) */
    --widget-size-regular-tall-height: 400px;    /* Regular-tall: 400px (2x regular) */
    --widget-size-wide-height: 400px;            /* Wide: 400px (2x regular) */
    --widget-size-wide-short-height: 200px;      /* Wide-short: 200px */
    /* Compact Padding & Spacing */
    --widget-header-padding-y: 0.75rem;
    --widget-header-padding-x: 1rem;
    --widget-body-padding-y: 0.75rem;
    --widget-body-padding-x: 1rem;
    --widget-inner-gap: 0.5rem;
    /* Responsive Grid Configuration */
    --grid-column-min-width: 160px; /* Half width: 160px instead of 320px */
    --grid-gap: 1rem;
}

/* ========================================
   GRID WIDGET WRAPPER - GLOBAL STYLES
   This ensures widgets fill their grid cells
   ======================================== */

.grid-widget {
    display: flex;
    flex-direction: column;
    width: fit-content;
}

.grid-widget .dashboard-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.grid-widget .panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ========================================
   DASHBOARD PANEL - GLOBAL STYLES
   Base styles for all widget containers
   ======================================== */

.dashboard-panel {
    background: var(--bg-primary);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
    cursor: default;
    user-select: none;
    position: relative;
    max-width: 400px;
    width: fit-content;
}

.dashboard-panel * {
    user-select: none;
}

.dashboard-panel:hover:not(.dragging) {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--bs-primary);
}

/* Locked state - default */
.dashboard-panel.locked {
    cursor: default;
}

/* Editable state - when in edit mode */
.dashboard-panel.editable {
    cursor: grab;
    border-style: dashed;
}

.dashboard-panel.editable:active {
    cursor: grabbing;
}

/* Drag and Drop States */
.dashboard-panel.dragging {
    opacity: 0.5;
    transform: scale(0.95) rotate(1deg);
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
    border-color: var(--bs-primary);
}

.dashboard-panel.drag-over {
    border: 2px solid var(--bs-primary);
    border-style: dashed;
    background: var(--bg-tertiary);
    transform: scale(1.02);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* ========================================
   PANEL HEADER - GLOBAL STYLES
   ======================================== */

.panel-header {
    background: linear-gradient(135deg, var(--bs-primary), var(--primary-dark));
    color: var(--text-light);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.panel-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-header h3 i {
    font-size: 1.25rem;
    opacity: 0.9;
}

.panel-controls .btn-icon {
    color: var(--text-light);
    opacity: 0.85;
}

.panel-controls .btn-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* ========================================
   PANEL BODY - GLOBAL STYLES
   ======================================== */

.panel-body {
    padding: 1.5rem;
    background: var(--bg-primary);
}

.panel-body * {
    user-select: auto;
}

/* ========================================
   WIDGET LOADING/ERROR STATES
   ======================================== */

.widget-loading,
.widget-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    gap: 0.75rem;
    min-height: 200px;
}

.widget-loading i,
.widget-error i {
    font-size: 2rem;
    opacity: 0.6;
}

.widget-loading i {
    color: var(--bs-primary);
    animation: spin 1s linear infinite;
}

.widget-loading span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.widget-error {
    color: var(--bs-danger);
}

.widget-error i {
    color: var(--bs-danger);
}

.widget-error .btn-theme {
    margin-top: 0.5rem;
}

/* ========================================
   STATISTICS WIDGET - GLOBAL STYLES
   ======================================== */

.statistics-widget {
    width: 100%;
    height: 100%;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--bs-border-radius);
    border: 1px solid var(--bs-border-color);
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--bs-primary);
}

.stat-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bs-primary), var(--primary-dark));
    border-radius: var(--bs-border-radius);
    color: var(--text-light);
    box-shadow: var(--shadow-sm);
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 500;
}

.stat-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-style: italic;
}

/* ========================================
   QUICK ACTIONS - GLOBAL STYLES
   ======================================== */

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bs-primary), var(--primary-dark));
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 0;
}

.action-btn i,
.action-btn span {
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.action-btn i {
    font-size: 2rem;
    color: var(--bs-primary);
}

.action-btn span {
    font-size: 0.875rem;
    font-weight: 600;
}

.action-btn:hover {
    background: var(--bg-primary);
    border-color: var(--bs-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.action-btn:hover::before {
    opacity: 0.05;
}

.action-btn:hover i {
    color: var(--bs-primary);
    transform: scale(1.1);
}

.action-btn:hover span {
    color: var(--bs-primary);
}

.action-btn:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   PLACEHOLDER CONTENT - GLOBAL STYLES
   ======================================== */

.activity-placeholder,
.notification-placeholder,
.placeholder-content {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 1rem;
}

.activity-placeholder p,
.notification-placeholder p,
.placeholder-content p {
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.placeholder-content h4 {
    margin-bottom: 1rem;
    color: var(--bs-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
    text-align: left;
    background: var(--bg-secondary);
    border-radius: var(--bs-border-radius);
    padding: 1rem;
}

.feature-list li {
    padding: 0.5rem 0;
    padding-left: 2rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.feature-list li::before {
    content: "•";
    position: absolute;
    left: 0.75rem;
    color: var(--bs-primary);
    font-weight: bold;
    font-size: 1.25rem;
    line-height: 1;
}

/* ========================================
ANIMATIONS
======================================== */

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

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

.dashboard-panel {
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

/* Stagger animation for multiple widgets */
.dashboard-panel:nth-child(1) { animation-delay: 0.05s; }
.dashboard-panel:nth-child(2) { animation-delay: 0.1s; }
.dashboard-panel:nth-child(3) { animation-delay: 0.15s; }
.dashboard-panel:nth-child(4) { animation-delay: 0.2s; }
.dashboard-panel:nth-child(5) { animation-delay: 0.25s; }
.dashboard-panel:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .action-buttons {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .panel-header h3 {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .action-btn {
        padding: 1rem 0.75rem;
    }

    .action-btn i {
        font-size: 1.5rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .panel-controls {
        display: none !important;
    }

    .dashboard-panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

