/**
 * KPI Management Flexible - Styles
 */

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

/* ========================================
   HEADER & YEAR NAVIGATION
   ======================================== */

.kpi-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.kpi-title-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.title-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.title-icon i {
    font-size: 1.75rem;
    color: white;
}

.kpi-title-section .page-title {
    font-size: 1.875rem;
    font-weight: 800;
    margin: 0 0 0.75rem 0;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.kpi-title-section .page-subtitle {
    font-size: 1.125rem;
    margin: 0;
    font-weight: 400;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

.kpi-title-section .page-subtitle strong {
    font-weight: 700;
}

.year-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.year-nav-btn {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
}

.year-nav-btn i {
    font-size: 1.25rem;
}

.year-nav-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.year-nav-btn:active {
    transform: scale(0.95);
}

.current-year-box {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    text-align: center;
    min-width: 160px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.year-value {
    font-size: 2.5rem;
    font-weight: 900;
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.current-badge {
    background: #10b981;
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

/* ========================================
   ACTION BAR
   ======================================== */

.kpi-action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 1.375rem 2.75rem;
    border: none;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    min-width: 240px;
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

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

.btn-action span {
    display: inline-block;
    font-size: 1.25rem;
}

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

.btn-edit {
    background: #3b82f6;
    color: white;
}

.btn-delete {
    background: #ef4444;
    color: white;
}

.btn-export {
    background: #10b981;
    color: white;
}

.btn-copy {
    background: #f59e0b;
    color: white;
}

.btn-cancel {
    background: #6b7280;
    color: white;
}

.btn-recalculate {
    background: #8b5cf6;
    color: white;
}

.btn-distribute {
    background: #f59e0b;
    color: white;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========================================
   SUMMARY CARDS
   ======================================== */

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

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

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

.summary-card .card-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.875rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.summary-card.sales .card-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.summary-card.activities .card-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.summary-card.visits .card-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.summary-card.wins .card-icon {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

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

.summary-card .card-label {
    font-size: 1.125rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.summary-card .card-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #000000;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.summary-card .card-target {
    font-size: 0.9375rem;
    color: #374151;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.summary-card .progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.summary-card .progress-fill.sales-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.summary-card .progress-fill.activities-fill {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}

.summary-card .progress-fill.visits-fill {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.summary-card .progress-fill.wins-fill {
    background: linear-gradient(90deg, #43e97b, #38f9d7);
}

.summary-card .card-percentage {
    font-size: 1.375rem;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.summary-card.sales .card-percentage {
    color: #5b21b6;
}

.summary-card.activities .card-percentage {
    color: #be123c;
}

.summary-card.visits .card-percentage {
    color: #0369a1;
}

.summary-card.wins .card-percentage {
    color: #047857;
}

/* ========================================
   SECTIONS
   ======================================== */

.kpi-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kpi-section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

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

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

.kpi-section-header .section-description {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ========================================
   TABLES
   ======================================== */

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

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

.kpi-table thead {
    background: #f9fafb;
}

.kpi-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.kpi-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

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

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

.kpi-table .total-row {
    background: #f3f4f6;
    font-weight: 700;
}

.kpi-table.monthly-table {
    font-size: 0.875rem;
}

/* ========================================
   BADGES
   ======================================== */

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

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

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

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

/* ========================================
   MONTHLY TABLE - TARGET vs ACTUAL
   ======================================== */

.monthly-table th.sub-header {
    font-size: 0.75rem;
    padding: 0.5rem;
    background: #f3f4f6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.monthly-table .target-cell {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.monthly-table .actual-cell {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

/* ========================================
   TABLE ACTION BUTTONS
   ======================================== */

.btn-table-action {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #6b7280;
}

.btn-table-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-table-action.btn-edit-inline {
    color: #3b82f6;
}

.btn-table-action.btn-edit-inline:hover {
    background: #3b82f6;
    color: white;
}

.btn-table-action.btn-view {
    color: #10b981;
}

.btn-table-action.btn-view:hover {
    background: #10b981;
    color: white;
}

.btn-table-action.btn-delete {
    color: #ef4444;
}

.btn-table-action.btn-delete:hover {
    background: #ef4444;
    color: white;
}

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

/* ========================================
   NO DATA STATE
   ======================================== */

.kpi-no-data {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.kpi-no-data h3 {
    font-size: 1.5rem;
    margin: 1rem 0;
    color: #374151;
}

/* ========================================
   FORM
   ======================================== */

.kpi-form-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-title i {
    color: #667eea;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.form-section h3 i {
    color: #667eea;
}

.btn-add-kpi {
    padding: 0.625rem 1.25rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add-kpi:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.form-section.sales-kpi {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.form-section.technical-kpi {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.05) 0%, rgba(245, 87, 108, 0.05) 100%);
}

.section-note {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.kpi-row.custom-kpi-row {
    grid-template-columns: 1fr 1fr auto;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
}

.kpi-input-group {
    display: flex;
    flex-direction: column;
}

.kpi-input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.kpi-input-group input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

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

.kpi-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.btn-kpi-action {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-kpi-action.btn-view {
    background: #3b82f6;
    color: white;
}

.btn-kpi-action.btn-view:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.btn-kpi-action.btn-delete {
    background: #ef4444;
    color: white;
}

.btn-kpi-action.btn-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

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

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

@media (max-width: 768px) {
    .kpi-management-flexible {
        padding: 1rem;
    }

    .kpi-header {
        padding: 2.5rem 1.5rem;
    }

    .title-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 1.25rem;
    }

    .title-icon i {
        font-size: 2rem;
    }

    .kpi-title-section .page-title {
        font-size: 2rem;
    }

    .kpi-title-section .page-subtitle {
        font-size: 1.125rem;
        padding: 0.5rem 1.5rem;
    }

    .year-navigation {
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
    }

    .year-nav-btn {
        width: 100%;
        justify-content: center;
        padding: 1.125rem 1.75rem;
        font-size: 1.25rem;
    }

    .current-year-box {
        width: 100%;
        padding: 1.5rem 2rem;
    }

    .year-value {
        font-size: 3rem;
    }

    .kpi-action-bar {
        flex-direction: column;
        width: 100%;
        gap: 1.25rem;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
        padding: 1.5rem 2.25rem;
        font-size: 1.25rem;
        min-width: unset;
    }
    
    .btn-action i {
        font-size: 1.5rem;
    }

    .kpi-summary-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .kpi-row.custom-kpi-row {
        grid-template-columns: 1fr;
    }

    .kpi-actions {
        justify-content: flex-start;
        padding-top: 0.5rem;
    }

    .section-header-with-action {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-add-kpi {
        width: 100%;
        justify-content: center;
    }

    .kpi-table {
        font-size: 0.875rem;
    }

    .kpi-table th,
    .kpi-table td {
        padding: 0.5rem;
    }
}
