/* Analysis Matrix Styles - Similar to target_matrix */
.analysis-cell {
    padding: 0.25rem !important;
    min-width: 100px;
    position: relative;
}

.analysis-cell.completed-goal-cell {
    background: linear-gradient(135deg, #e0f2fe, #b3e5fc) !important;
    border: 2px solid #0288d1 !important;
}

.analysis-cell.has-value {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-left: 3px solid var(--success-color);
}

.analysis-cell.empty {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.02));
    border-left: 3px solid var(--danger-color);
}

.target-cell-container {
    margin-bottom: 0.3rem;
    position: relative;
}

.target-cell-container.saving::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border: 2px solid #007bff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    pointer-events: none;
}

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

.analysis-target-input {
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    font-size: 0.85rem;
    padding: 0.4rem 0.3rem;
}

.analysis-target-input:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--border-color);
}

.analysis-target-input:focus {
    background-color: white;
    border: 2px solid var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px #b8941f
}

.analysis-cell.has-value .analysis-target-input,
.analysis-target-input:not(:placeholder-shown) {
    background-color: rgba(16, 185, 129, 0.05);
    border-color: var(--success-color);
    color: var(--success-color);
    font-weight: 600;
}

.result-input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.analysis-result-input {
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    font-size: 0.8rem;
    padding: 0.35rem 0.25rem;
}

.analysis-result-input:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--info-color);
}

.analysis-result-input:focus {
    background-color: white;
    border: 2px solid var(--info-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.analysis-result-input:not(:placeholder-shown) {
    background-color: rgba(59, 130, 246, 0.05);
    border-color: var(--info-color);
    color: var(--info-color);
    font-weight: 600;
}

.completed-goal-cell .analysis-result-input {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--info-color);
    color: var(--info-color);
    font-weight: 600;
}

.result-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    margin-top: 0.1rem;
}

.result-target-info {
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.result-percentage {
    font-weight: bold;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.result-percentage.success {
    color: #059669;
}

.result-percentage.warning {
    color: #d97706;
}

.result-percentage.danger {
    color: #dc2626;
}
.nav-tabs .nav-link {
    color: #495057;
}

.nav-tabs .nav-link.active {
    font-weight: 500;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table th {
    border-top: none;
    font-weight: 600;
}

.btn-sm {
    font-size: 0.875rem;
}

#bulkTargetsTable {
    min-height: 200px;
}

.bulk-date, .bulk-target {
    border: 1px solid #dee2e6;
}

.bulk-date:focus, .bulk-target:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Analysis Matrix Styles */
.analysis-matrix-table {
    font-size: 0.9rem;
}

.analysis-matrix-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa !important;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

.sticky-column {
    position: sticky;
    left: 0;
    background: #f8f9fa !important;
    z-index: 5;
    min-width: 120px;
    border-right: 2px solid #dee2e6;
}

/* Quarter header styles - override sticky-column background with !important */
.quarter {
    color: #fff !important;
    padding: 0.55rem 0.8rem !important;
    text-align: center !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
    white-space: nowrap !important;
    background-clip: padding-box !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12) !important;
    z-index: 6 !important;
}

.quarter__range {
    font-weight: 600 !important;
    opacity: 0.9 !important;
    font-size: 0.9em !important;
}

.quarter--q1 {
    background: linear-gradient(135deg, rgb(74, 144, 226), rgb(53, 122, 189)) !important;
}

.quarter--q2 {
    background: linear-gradient(135deg, rgb(74, 144, 226), rgb(53, 122, 189)) !important;
}

.quarter--q3 {
    background: linear-gradient(135deg, rgb(74, 144, 226), rgb(53, 122, 189)) !important;
}

.quarter--q4 {
    background: linear-gradient(135deg, rgb(74, 144, 226), rgb(53, 122, 189)) !important;
}

.quarter--annual {
    background: linear-gradient(135deg, rgb(40, 167, 69), rgb(30, 126, 52)) !important;
}

.analysis-cell {
    padding: 0.25rem !important;
    min-width: 100px;
}

.analysis-input {
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
}

.analysis-input:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ced4da;
}

.analysis-input:focus {
    background: white;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.analysis-input.changed {
    background: #fff3cd;
    border-color: #ffc107;
}

.analysis-input:not(:placeholder-shown) {
    background: #d4edda;
    border-color: #28a745;
    font-weight: 600;
}

.analysis-matrix-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Responsive Design for Matrix Toolbar */
.matrix-toolbar-container {
    flex-wrap: wrap;
}

.matrix-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.matrix-toolbar .btn {
    white-space: nowrap;
    flex: 0 0 auto;
}

.matrix-stats {
    text-align: center;
    flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .matrix-toolbar-container {
        flex-direction: column;
    }
    
    .matrix-toolbar {
        width: 100%;
        justify-content: center;
    }
    
    .matrix-toolbar .btn {
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
    }
    
    .matrix-stats {
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .matrix-toolbar {
        flex-direction: column;
    }
    
    .matrix-toolbar .btn {
        width: 100%;
        min-width: 100%;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .matrix-toolbar .btn i {
        margin-right: 0.25rem !important;
    }
}

@media (max-width: 575.98px) {
    .matrix-toolbar .btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
    }
    
    .matrix-stats {
        font-size: 0.8rem;
    }
}
