/* ============================================
   JIRA ANALYTICS - CUSTOM DESIGN SYSTEM
   Modern, Professional UI/UX Styles
   ============================================ */

/* ============================================
   1. TYPOGRAPHY & BASE STYLES
   ============================================ */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --control-height: 48px;
    --control-height-sm: 40px;
    --control-height-lg: 56px;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   2. CARD COMPONENTS
   ============================================ */
.report-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.report-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
}

.report-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.report-card-title i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.report-card-body {
    padding: 0;
}

/* ============================================
   3. METRIC CARDS
   ============================================ */
.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: white;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.metric-card.metric-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.metric-card.metric-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.metric-card.metric-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.metric-card.metric-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.metric-card.metric-secondary {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.metric-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.metric-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    display: block;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.metric-unit {
    display: block;
    font-size: 0.875rem;
    opacity: 0.8;
    font-weight: 500;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
}

/* ============================================
   4. BUTTONS & CONTROLS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    white-space: nowrap;
    min-height: var(--control-height);
    line-height: 1;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    min-height: var(--control-height-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: var(--control-height-lg);
}

.btn-group {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================
   5. FORM CONTROLS
   ============================================ */
.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: white;
    line-height: 1.5;
    min-height: var(--control-height);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    min-height: var(--control-height);
}

select.form-control[multiple] {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    overflow: auto;
}

select.form-control[multiple] option {
    padding: 0.25rem 0.5rem;
}

.form-control[type="number"] {
    min-height: var(--control-height);
}

/* ============================================
   6. FILTER SECTION
   ============================================ */
.filter-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1.5rem;
    align-items: end;
}

/* ============================================
   7. DATA TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table thead th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody td {
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--gray-900);
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   8. BADGES & STATUS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

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

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

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

/* ============================================
   9. CHARTS & VISUALIZATIONS
   ============================================ */
.chart-container {
    position: relative;
    height: 350px;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-lg);
}

.chart-header {
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* ============================================
   10. PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title i {
    color: var(--primary-color);
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ============================================
   11. EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ============================================
   12. LOADING STATES
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.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;
}

/* ============================================
   13. RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-group {
        width: 100%;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-grid > *:last-child {
        grid-column: 1 / -1;
    }
}

/* ============================================
   14. ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   15. RTL SUPPORT
   ============================================ */
[dir="rtl"] .form-select {
    background-position: left 0.5rem center;
    padding-left: 2.5rem;
    padding-right: 1rem;
}

[dir="rtl"] .page-title {
    flex-direction: row-reverse;
}

[dir="rtl"] .report-card-title {
    flex-direction: row-reverse;
}
