/* ============================================
   MODERN DASHBOARD STYLES
   Stile moderne për boxet e dashboard-it
   ============================================ */

/* Box Header Styles */
.box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-secondary);
}

.box-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.box-header h3 i {
    font-size: 1.2em;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
}

.box:hover .box-header h3 i {
    transform: scale(1.1) rotate(5deg);
}

/* Stat Box Styles */
.stat-box {
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-box:hover::before {
    opacity: 1;
}

.stat-box.warning::before {
    background: linear-gradient(180deg, #f59e0b, #d97706);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stat-main {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: white;
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-number.danger {
    color: #ef4444;
}

.stat-label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.quote-box .quote-content {
    text-align: center;
    padding: 10px 5px;
}

.quote-box .quote-text {
    font-size: 1.15em;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0 0 10px;
}

.quote-box .quote-author {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-breakdown {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.stat-item-small {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-item-small:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-item-small.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.stat-item-small.active:hover {
    background: rgba(16, 185, 129, 0.15);
}

.stat-item-small.inactive {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.stat-item-small.inactive:hover {
    background: rgba(239, 68, 68, 0.15);
}

.stat-item-small i {
    font-size: 1.5em;
    transition: transform 0.3s ease;
}

.stat-item-small.active i {
    color: #10b981;
}

.stat-item-small.inactive i {
    color: #ef4444;
}

.stat-item-small:hover i {
    transform: scale(1.2);
}

.stat-item-small span {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-item-small small {
    font-size: 0.8em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart Box Styles */
.chart-box {
    position: relative;
}

.chart-container-wrapper {
    padding: 15px 10px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-top: 10px;
    position: relative;
    height: 260px;
}

.revenue-chart-wrapper {
    height: 300px;
}

.chart-box canvas {
    max-width: 100%;
}

/* Pulse Animation for Loading */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.stat-number:empty::after,
.stat-item-small span:empty::after {
    content: '...';
    animation: pulse-glow 1.5s ease-in-out infinite;
}

/* Gradient Backgrounds for Different Box Types */
.stat-box.primary .stat-main {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-box.success .stat-main {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-box.danger .stat-main {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-box.warning .stat-main {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-box.info .stat-main {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Shimmer Effect on Hover */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.stat-main::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
    pointer-events: none;
}

/* Icon Animations */
@keyframes bounce-subtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.box:hover .box-header h3 i {
    animation: bounce-subtle 0.6s ease;
}

/* Tooltip Styles */
.stat-item-small[data-tooltip] {
    position: relative;
}

.stat-item-small[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
}

.stat-item-small[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stat-main {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 2em;
    }
    
    .stat-breakdown {
        flex-direction: column;
        gap: 8px;
    }
    
    .stat-item-small {
        flex-direction: row;
        justify-content: space-between;
        padding: 12px;
    }
    
    .stat-item-small i {
        font-size: 1.2em;
    }
    
    .stat-item-small span {
        font-size: 1.2em;
    }
    
    .box-header h3 {
        font-size: 1em;
    }
    
    .chart-container-wrapper {
        padding: 10px 5px;
    }
}

/* Dark Mode Specific Adjustments */
[data-theme="dark"] .stat-main {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .chart-container-wrapper {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .stat-item-small {
    background: rgba(255, 255, 255, 0.05);
}

/* Light Mode Specific Adjustments */
[data-theme="light"] .stat-main {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

[data-theme="light"] .chart-container-wrapper {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .stat-item-small {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .stat-main {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

[data-theme="light"] .stat-number {
    color: #1e293b;
    text-shadow: none;
}

[data-theme="light"] .stat-number.danger {
    color: #ef4444;
}

[data-theme="light"] .stat-label {
    color: #475569;
}

/* Micro-interactions */
.box {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.box:hover {
    transform: translateY(-2px);
}

.box:active {
    transform: translateY(0);
}

/* Loading State */
.box.loading {
    pointer-events: none;
    opacity: 0.6;
}

.box.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Success/Error States */
.box.success {
    border-left: 4px solid #10b981;
}

.box.error {
    border-left: 4px solid #ef4444;
}

/* Fade-in Animation for Boxes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.box {
    animation: fadeInUp 0.5s ease-out;
}

.box:nth-child(1) { animation-delay: 0.05s; }
.box:nth-child(2) { animation-delay: 0.1s; }
.box:nth-child(3) { animation-delay: 0.15s; }
.box:nth-child(4) { animation-delay: 0.2s; }
.box:nth-child(5) { animation-delay: 0.25s; }
.box:nth-child(6) { animation-delay: 0.3s; }
.box:nth-child(7) { animation-delay: 0.35s; }
.box:nth-child(8) { animation-delay: 0.4s; }

/* Number Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-number.animated {
    animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
