/**
 * KZCRMS Global Flex Card Styles
 * Modern, consistent flex card components for the entire system
 * Version: 2.0
 */

/* =================================
   FLEX CONTAINER LAYOUTS
   ================================= */

/* Main Flex Containers */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.flex-container-center {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.flex-container-space-between {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    width: 100%;
}

/* Grid Variations */
.flex-grid-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-grid-2 > * {
    flex: 1;
    min-width: calc(50% - 0.5rem);
}

.flex-grid-3 {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-grid-3 > * {
    flex: 1;
    min-width: calc(33.333% - 0.67rem);
}

.flex-grid-4 {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-grid-4 > * {
    flex: 1;
    min-width: calc(25% - 0.75rem);
}

/* =================================
   STATISTICS CARDS
   ================================= */

.stats-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.flex-stat-card {
    flex: 1;
    min-width: 250px;
    max-width: 320px;
    padding: 1.5rem;
    border-radius: 15px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    height: 140px;
    cursor: pointer;
}

.flex-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.flex-stat-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(30px, -30px);
}

.flex-stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    margin-right: 1rem;
    min-width: 60px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.flex-stat-info {
    flex: 1;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flex-stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: white;
}

.flex-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    margin-right: 1rem;
    min-width: 60px;
    z-index: 1;
}

.stat-content {
    flex: 1;
    z-index: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-trend {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Stat Card Color Variants */
.flex-stat-card-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.flex-stat-card-success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.flex-stat-card-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.flex-stat-card-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.flex-stat-card-secondary {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.flex-stat-card-gradient {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.flex-stat-card-gradient .flex-stat-icon,
.flex-stat-card-gradient .flex-stat-number,
.flex-stat-card-gradient .flex-stat-label {
    color: #333;
}

/* =================================
   CONTENT CARDS
   ================================= */

.flex-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 1rem;
}

.flex-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.flex-card-header {
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.flex-card-body {
    padding: 1.25rem;
}

.flex-card-footer {
    padding: 1rem 1.25rem;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.05);
}

.flex-card-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flex-card-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.flex-card-subtitle {
    margin: 0.5rem 0 0 0;
    opacity: 0.8;
    font-size: 0.875rem;
}

/* Card Sizes */
.flex-card-sm {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.flex-card-md {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
}

.flex-card-lg {
    flex: 1;
    min-width: 400px;
    max-width: 600px;
}

.flex-card-xl {
    flex: 1;
    min-width: 500px;
}

.flex-card-full {
    width: 100%;
}

/* =================================
   PERFORMANCE CARDS
   ================================= */

.performance-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.flex-performance-card {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.flex-performance-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

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

.performance-header h6 {
    color: #2c3e50;
    font-weight: 600;
    flex: 1;
}

.performance-icon {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
}

.performance-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.performance-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* =================================
   LIST CARDS
   ================================= */

.flex-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flex-list-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 3px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.flex-list-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

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

.list-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.list-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.list-card-content {
    color: #6c757d;
    line-height: 1.5;
}

.list-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

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

.form-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.flex-form-card {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
}

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

.form-card-body {
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =================================
   ACTION CARDS
   ================================= */

.action-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-action-card {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 3px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.flex-action-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
    text-decoration: none;
    color: inherit;
}

.action-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.action-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.action-card-description {
    font-size: 0.875rem;
    color: #6c757d;
    line-height: 1.4;
}

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

@media (max-width: 1200px) {
    .flex-grid-4 > * {
        min-width: calc(33.333% - 0.67rem);
    }
}

@media (max-width: 992px) {
    .flex-grid-3 > *,
    .flex-grid-4 > * {
        min-width: calc(50% - 0.5rem);
    }
    
    .flex-stat-card {
        min-width: 280px;
    }
    
    .flex-performance-card {
        min-width: 300px;
    }
}

@media (max-width: 768px) {
    .flex-container,
    .flex-container-center,
    .flex-container-space-between {
        flex-direction: column;
    }
    
    .flex-grid-2 > *,
    .flex-grid-3 > *,
    .flex-grid-4 > * {
        min-width: 100%;
    }
    
    .stats-flex-container,
    .performance-flex-container,
    .form-flex-container,
    .action-flex-container {
        flex-direction: column;
    }
    
    .flex-stat-card,
    .flex-performance-card,
    .flex-form-card,
    .flex-action-card {
        min-width: 100%;
        max-width: 100%;
    }
    
    .flex-stat-card {
        height: 120px;
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        font-size: 2rem;
        margin-right: 0.75rem;
        min-width: 50px;
    }
}

@media (max-width: 576px) {
    .flex-container,
    .stats-flex-container,
    .performance-flex-container,
    .form-flex-container,
    .action-flex-container {
        gap: 0.75rem;
    }
    
    .flex-card-header,
    .flex-card-body,
    .form-card-body {
        padding: 1rem;
    }
    
    .flex-list-card {
        padding: 1rem;
    }
}

/* =================================
   UTILITY CLASSES
   ================================= */

.flex-item-grow {
    flex-grow: 1;
}

.flex-item-shrink {
    flex-shrink: 1;
}

.flex-item-no-shrink {
    flex-shrink: 0;
}

.flex-align-start {
    align-items: flex-start;
}

.flex-align-center {
    align-items: center;
}

.flex-align-end {
    align-items: flex-end;
}

.flex-justify-start {
    justify-content: flex-start;
}

.flex-justify-center {
    justify-content: center;
}

.flex-justify-end {
    justify-content: flex-end;
}

.flex-justify-between {
    justify-content: space-between;
}

.flex-gap-sm {
    gap: 0.5rem;
}

.flex-gap-md {
    gap: 1rem;
}

.flex-gap-lg {
    gap: 1.5rem;
}

.flex-gap-xl {
    gap: 2rem;
}

/* =================================
   ALERT COMPONENTS
   ================================= */

/* Base Flex Alert */
.flex-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

.flex-alert-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.flex-alert-content {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Alert Variants */
.flex-alert-info {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
    color: #0d47a1;
}

.flex-alert-info .flex-alert-icon {
    color: #2196f3;
}

.flex-alert-success {
    background-color: #e8f5e8;
    border-left-color: #4caf50;
    color: #1b5e20;
}

.flex-alert-success .flex-alert-icon {
    color: #4caf50;
}

.flex-alert-warning {
    background-color: #fff3e0;
    border-left-color: #ff9800;
    color: #e65100;
}

.flex-alert-warning .flex-alert-icon {
    color: #ff9800;
}

.flex-alert-danger {
    background-color: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
}

.flex-alert-danger .flex-alert-icon {
    color: #f44336;
}

/* =================================
   EMPTY STATE COMPONENTS
   ================================= */

.flex-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.flex-empty-state-icon {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.flex-empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.flex-empty-state-text {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* =================================
   PAGINATION COMPONENTS
   ================================= */

.flex-pagination {
    margin-top: 1.5rem;
}

.flex-pagination-info {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* =================================
   ACTION BUTTON COMPONENTS
   ================================= */

.flex-action-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.flex-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    background: none;
    flex: 1;
    justify-content: center;
    min-width: auto;
}

.flex-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

/* Action Button Variants */
.flex-action-btn-primary {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.flex-action-btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.flex-action-btn-secondary {
    background-color: #6b7280;
    color: white;
    border-color: #6b7280;
}

.flex-action-btn-secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
    color: white;
}

.flex-action-btn-success {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.flex-action-btn-success:hover {
    background-color: #059669;
    border-color: #059669;
    color: white;
}

.flex-action-btn-info {
    background-color: #06b6d4;
    color: white;
    border-color: #06b6d4;
}

.flex-action-btn-info:hover {
    background-color: #0891b2;
    border-color: #0891b2;
    color: white;
}

.flex-action-btn-warning {
    background-color: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.flex-action-btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: white;
}

.flex-action-btn-danger {
    background-color: #ef4444;
    color: white;
    border-color: #ef4444;
}

.flex-action-btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Mobile responsive adjustments for action buttons */
@media (max-width: 576px) {
    .flex-action-btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        min-width: 80px;
    }
}

/* =================================
   MOBILE RESPONSIVE COMPONENTS
   ================================= */

.mobile-cards {
    padding: 0.5rem;
}

.mobile-cards .flex-card {
    margin-bottom: 1rem;
}

/* =================================
   AUTHENTICATION COMPONENTS
   ================================= */

.flex-auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.flex-auth-wrapper {
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.flex-auth-header {
    text-align: center;
}

.flex-auth-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
}

.flex-auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.flex-auth-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.flex-auth-card {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    overflow: hidden;
}

.flex-auth-footer {
    text-align: center;
    font-size: 0.875rem;
}

.flex-auth-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    margin-left: 0.25rem;
}

.flex-auth-link:hover {
    color: #4c63d2;
    text-decoration: underline;
}

/* =================================
   THEME VARIATIONS
   ================================= */

/* Primary Theme */
.flex-card-primary .flex-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Success Theme */
.flex-card-success .flex-card-header {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

/* Warning Theme */
.flex-card-warning .flex-card-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* Info Theme */
.flex-card-info .flex-card-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

/* Danger Theme */
.flex-card-danger .flex-card-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

/* Dark Theme */
.flex-card-dark .flex-card-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

/* =================================
   ANIMATION CLASSES
   ================================= */

.flex-fade-in {
    animation: flexFadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.flex-slide-up {
    animation: flexSlideUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.flex-scale-in {
    animation: flexScaleIn 0.4s ease-out forwards;
    opacity: 0;
    transform: scale(0.9);
}

@keyframes flexFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes flexSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flexScaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stagger animations for multiple cards */
.flex-container > .flex-fade-in:nth-child(1) { animation-delay: 0.1s; }
.flex-container > .flex-fade-in:nth-child(2) { animation-delay: 0.2s; }
.flex-container > .flex-fade-in:nth-child(3) { animation-delay: 0.3s; }
.flex-container > .flex-fade-in:nth-child(4) { animation-delay: 0.4s; }
.flex-container > .flex-fade-in:nth-child(5) { animation-delay: 0.5s; }
.flex-container > .flex-fade-in:nth-child(6) { animation-delay: 0.6s; }