/**
 * KPI Management Styles
 * Modern, professional design for KPI import/export/edit interface
 */

.kpi-management-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Section */
.kpi-management-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.kpi-title-section {
    flex: 1;
}

.kpi-title-section .page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kpi-title-section .page-title i {
    color: #667eea;
}

.kpi-title-section .page-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
}

/* Action Buttons */
.kpi-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-import {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-export {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 233, 123, 0.4);
}

.btn-edit {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-edit:hover,
.btn-edit.active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

.btn-save {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

/* Summary Cards */
.kpi-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.kpi-summary-card .card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.kpi-summary-card .card-content {
    flex: 1;
}

.kpi-summary-card .card-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.kpi-summary-card .card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.kpi-summary-card .card-target {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.kpi-summary-card .card-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kpi-summary-card .progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.kpi-summary-card .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.kpi-summary-card .progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #667eea;
    min-width: 45px;
    text-align: right;
}

/* Table Cards */
.kpi-tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1.5rem;
}

.kpi-table-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.kpi-table-card.full-width {
    grid-column: 1 / -1;
}

.table-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-responsive {
    overflow-x: auto;
}

.kpi-table {
    width: 100%;
    border-collapse: collapse;
}

.kpi-table thead th {
    background: #f9fafb;
    padding: 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.kpi-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
    color: #1f2937;
}

.kpi-table tbody tr:hover {
    background: #f9fafb;
}

.kpi-table tbody tr.total-row {
    background: #f3f4f6;
    font-weight: 600;
}

.kpi-table tbody tr.total-row:hover {
    background: #e5e7eb;
}

.kpi-table .text-right {
    text-align: right;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Input Fields (Edit Mode) */
.kpi-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.kpi-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.kpi-input-sm {
    width: 80px;
    padding: 0.375rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.3s ease;
}

.kpi-input-sm:focus {
    outline: none;
    border-color: #667eea;
}

.monthly-table .kpi-input-sm {
    width: 70px;
}

/* Import Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

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

.modal-header h2 i {
    color: #667eea;
}

.btn-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

/* Import Options */
.import-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.import-option {
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.3s ease;
}

.import-option:hover {
    border-color: #667eea;
}

.import-option h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.import-option h3 i {
    color: #667eea;
}

.import-option p {
    margin: 0 0 1rem 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.import-option input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.import-option input[type="file"]:hover {
    border-color: #667eea;
}

.import-option textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.import-option textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .kpi-tables-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-management-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .kpi-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-action {
        flex: 1;
        justify-content: center;
    }
    
    .kpi-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-tables-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .table-responsive {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .kpi-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .kpi-management-container {
        padding: 1rem;
    }
    
    .kpi-title-section .page-title {
        font-size: 1.5rem;
    }
    
    .kpi-summary-card {
        flex-direction: column;
        text-align: center;
    }
    
    .kpi-summary-card .card-icon {
        margin: 0 auto;
    }
}

/* ========================================
 * KPI Management V2 Styles
 * ======================================== */

.kpi-summary-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.kpi-summary-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.2);
    border: 2px solid #667eea;
}

.kpi-section {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kpi-section-header {
    padding: 2rem;
    color: white;
}

.kpi-section-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.kpi-section-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.kpi-table {
    width: 100%;
    border-collapse: collapse;
}

.kpi-table thead tr {
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
}

.kpi-table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 700;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 3px solid #e5e7eb;
}

.kpi-table td {
    padding: 1.25rem 1rem;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
}

.kpi-table tbody tr:hover {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

.kpi-table .monthly-row:nth-child(even) {
    background: #f9fafb;
}

.kpi-input {
    width: 100%;
    max-width: 200px;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    transition: all 0.3s ease;
}

.kpi-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-action {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

.view-mode {
    display: inline;
}

.edit-mode {
    display: none;
}
