/* styles.css - Dashboard Centralizer Styles */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
    --warning-gradient: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #434343 0%, #000000 100%);
    --material-gradient: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    --finished-gradient: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    --pm-gradient: linear-gradient(135deg, #FF8008 0%, #FFC837 100%);
    --tda-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Prompt', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

.header-section {
    padding: 20px 25px 12px 25px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-align: center;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 8px 0;
    padding-left: 16px;
    border-left: 4px solid;
    border-image: var(--primary-gradient) 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Prompt', sans-serif;
}

.cards-container {
    display: flex;
    overflow-x: auto;
    padding: 20px 20px 60px 20px;
    gap: 18px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
}

.cards-container::-webkit-scrollbar {
    height: 8px;
}

.cards-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    margin: 0 50px;
}

.cards-container::-webkit-scrollbar-thumb {
    background: linear-gradient(to right, #667eea, #764ba2);
    border-radius: 8px;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 24px rgba(31, 38, 135, 0.12);
    padding: 24px;
    min-width: 380px;
    max-width: 380px;
    height: 680px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.dashboard-card:hover::before {
    transform: translateY(0);
}

.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.2);
    text-decoration: none;
    color: inherit;
}

.card-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.01em;
    font-family: 'Prompt', sans-serif;
}

.card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--primary-gradient);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-icon svg {
    color: white;
    width: 22px;
    height: 22px;
}

.card-body-custom {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 65px;
}

.card-body-custom::-webkit-scrollbar {
    width: 4px;
}

.card-body-custom::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.card-body-custom::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.metric-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.02em;
}

.metric-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
}

/* Last Update Widget */
.last-update-widget {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(0, 0, 0, 0.05);
}

.last-update-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
}

.last-update-date {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
    font-family: 'Jakarta Sans', sans-serif;
    line-height: 1.2;
}

.metric-change {
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    margin-top: 8px;
}

.metric-change.positive {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.metric-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.card-footer-custom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 2px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.version {
    color: #999;
    font-size: 0.7rem;
    font-weight: 500;
}

.date {
    color: #999;
    font-size: 0.7rem;
    font-weight: 500;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
    margin: 16px 0;
}

.mini-chart {
    height: 180px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-pending {
    background: rgba(251, 191, 36, 0.1);
    color: #d97706;
}

.status-warning {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.progress-custom {
    height: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-bar-custom {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    border-radius: 8px;
}

.scroll-button {
    position: absolute;
    top: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.scroll-button:hover {
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.scroll-button.left {
    left: 16px;
}

.scroll-button.right {
    right: 16px;
}

.cards-wrapper {
    position: relative;
    margin: 0 40px;
}

.container-fluid {
    padding: 0;
    min-height: 100vh;
}

.mini-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mini-stat-row:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.channel-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.mini-stat-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
}

.comparison-info {
    display: flex;
    gap: 8px;
    align-items: center;
}

.prev-month-value {
    font-size: 0.65rem;
    color: #888;
    font-family: 'Prompt', sans-serif;
}

.growth-indicator {
    font-size: 0.65rem;
    font-weight: 600;
}

.growth-positive {
    color: #10b981;
}

.growth-negative {
    color: #ef4444;
}

.mini-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a1a;
    flex-shrink: 0;
}

.section-divider {
    font-size: 0.75rem;
    font-weight: 700;
    color: #666;
    margin: 16px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Modal Styles */
.modal-backdrop {
    display: none;
}

.modal-backdrop.show {
    display: block;
}

.modal {
    display: none;
}

.modal.show {
    display: block;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    opacity: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(to bottom, #f9fafb, #ffffff);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Prompt', sans-serif;
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.modal-stat-card {
    background: linear-gradient(135deg, #f6f9fc 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.modal-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.modal-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
}

.modal-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
    font-family: 'Prompt', sans-serif;
}

.modal-chart-container {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.modal-chart {
    height: 300px;
    position: relative;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.modal-btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.modal-btn-secondary {
    background: #e5e7eb;
    color: #666;
}

.modal-btn-secondary:hover {
    background: #d1d5db;
}

.modal-btn-info {
    background: var(--info-gradient);
    color: white;
}

.modal-btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

/* Loading and Error States */
.placeholder-loading {
    display: inline-block;
    color: #999;
    font-size: 1.2rem;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

.error-state {
    color: #dc2626;
    font-size: 0.9rem;
}

/* Material Status Indicators */
.material-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.good {
    background: #38ef7d;
}

.status-indicator.warning {
    background: #f2c94c;
}

.status-indicator.critical {
    background: #ff6a00;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-title {
        font-size: 1.6rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .dashboard-card {
        min-width: 280px;
        max-width: 280px;
        height: 620px;
        padding: 20px;
    }
    
    .card-title {
        font-size: 1.05rem;
    }
    
    .card-icon {
        width: 38px;
        height: 38px;
    }
    
    .card-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 160px;
    }
    
    .mini-chart {
        height: 150px;
    }
    
    .scroll-button {
        top: 300px;
        width: 44px;
        height: 44px;
    }
    
    .modal {
        width: 95%;
        max-width: 700px;
    }
}

/* Procurement Modal Specific Styles */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.status-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    position: relative;
}

.status-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.status-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 auto;
}

.status-indicator.pending {
    background: #f59e0b;
}

.status-indicator.approved {
    background: #3b82f6;
}

.status-indicator.shipped {
    background: #10b981;
}

.status-indicator.received {
    background: #8b5cf6;
}

.critical-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-bottom: 8px;
}

.critical-name {
    font-weight: 500;
    flex: 1;
}

.critical-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.critical-status.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.critical-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

@media (max-width: 640px) {
    .modal-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-btn {
        width: 100%;
        text-align: center;
    }
    
    .critical-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .critical-status {
        align-self: flex-end;
    }
}

/* Card Detail Button Styles */
.card-detail-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.btn-detail-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Plus Jakarta Sans', 'Prompt', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-decoration: none;
    min-height: 32px;
}

.btn-detail-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6c4190 100%);
}

.btn-detail-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.btn-detail-card i {
    flex-shrink: 0;
}

.btn-detail-card span {
    white-space: nowrap;
}

/* Responsive adjustments for card detail buttons */
@media (max-width: 768px) {
    .btn-detail-card {
        font-size: 0.75rem;
        padding: 6px 12px;
        gap: 4px;
    }
    
    .btn-detail-card i {
        width: 12px;
        height: 12px;
    }
}

/* Spinner animation for loading states */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}