/* ============================================
   LOADING STATES & SKELETON SCREENS
   Sprint 1-2: Frontend Modernizasyonu
   ============================================ */

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spinner 0.6s linear infinite;
}

.loading-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay-content {
    text-align: center;
}

.loading-overlay-text {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
}

/* Skeleton Screens */
.skeleton {
    background: linear-gradient(
        90deg,
        #f3f4f6 0%,
        #e5e7eb 50%,
        #f3f4f6 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text-lg {
    height: 24px;
}

.skeleton-text-sm {
    height: 12px;
}

.skeleton-title {
    height: 32px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Skeleton KPI Card */
.skeleton-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.skeleton-kpi-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.skeleton-kpi-code {
    width: 60px;
    height: 20px;
}

.skeleton-kpi-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.skeleton-kpi-title {
    height: 24px;
    width: 80%;
    margin-bottom: 20px;
}

.skeleton-kpi-metrics {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.skeleton-kpi-metric {
    flex: 1;
}

.skeleton-kpi-value {
    height: 36px;
    width: 80px;
    margin-bottom: 8px;
}

.skeleton-kpi-label {
    height: 14px;
    width: 60px;
}

.skeleton-kpi-progress {
    height: 8px;
    margin-bottom: 12px;
}

.skeleton-kpi-footer {
    display: flex;
    justify-content: space-between;
}

.skeleton-kpi-trend {
    width: 60px;
    height: 16px;
}

.skeleton-kpi-date {
    width: 80px;
    height: 16px;
}

/* Skeleton Table */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.skeleton-table-cell {
    flex: 1;
    height: 20px;
}

/* Loading Button States */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

.btn-loading.btn-primary::after {
    border-top-color: white;
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Loading States for Specific Components */
.process-panel-loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-card-loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Progress Bar */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* Skeleton Grid */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 24px;
}

/* Loading Message */
.loading-message {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.loading-message-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #3b82f6;
}

.loading-message-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.loading-message-subtext {
    font-size: 14px;
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .skeleton-kpi-metrics {
        flex-direction: column;
        gap: 16px;
    }
}
