/* AI-Header: Reusable card component styles */
/* Date: 2025-07-13 */

/* ===========================================
   MODERN TYPOGRAPHY VARIABLES
   =========================================== */

:root {
    /* Cross-platform font family - optimized for web and MAUI */
    --font-family-primary: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Modern font weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Typography scale for professional cards */
    --font-size-xs: 0.75rem;     /* 12px - small labels */
    --font-size-sm: 0.875rem;    /* 14px - body text */
    --font-size-base: 1rem;      /* 16px - default */
    --font-size-lg: 1.125rem;    /* 18px - emphasis */
    --font-size-xl: 1.25rem;     /* 20px - headers */
    --font-size-2xl: 1.5rem;     /* 24px - names */
    --font-size-3xl: 1.875rem;   /* 30px - large headers */
}

/* Global typography optimization */
body {
    font-family: var(--font-family-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===========================================
   CARDS - BASE STRUCTURE
   =========================================== */

/* Base Card Styles */
.card-container {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 1rem;
    background: inherit;
    border: 1px solid;
}

.card-header {
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid;
    background: rgba(0, 0, 0, 0.02);
}

/* ===========================================
   CARDS - THEME ENHANCEMENTS
   =========================================== */

/* Light Theme Cards */
[data-bs-theme="light"] .card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Ensures background stays within border radius */
}

[data-bs-theme="light"] .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 0; /* Remove border radius from header since card handles it */
    color: #495057;
}

[data-bs-theme="light"] .card-body {
    background: #ffffff;
    color: #212529;
}

[data-bs-theme="light"] .card-header.bg-primary {
    background: linear-gradient(135deg, #722F37 0%, #5d252b 100%) !important;
    color: #ffffff !important;
}

/* Dark Theme Cards */
[data-bs-theme="dark"] .card {
    background: #000000; /* Updated to black background */
    border: 1px solid #333333; /* Updated border color for better contrast */
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden; /* Ensures background stays within border radius */
}

[data-bs-theme="dark"] .card-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%); /* Updated gradient to black */
    border-bottom: 1px solid #333333; /* Updated border color */
    border-radius: 0; /* Remove border radius from header since card handles it */
    color: #ffffff;
}

[data-bs-theme="dark"] .card-header.bg-primary {
    background: linear-gradient(135deg, #722F37 0%, #5d252b 100%) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-body {
    background: #000000; /* Updated to black background */
    border-radius: 0; /* Remove border radius from body since card handles it */
    color: #ffffff;
}

/* Card Variants */
.card-primary .card-header {
    background: #722F37;
    color: white;
    border-bottom-color: #8B4A52;
}

.card-secondary .card-header {
    background: #6c757d;
    color: white;
    border-bottom-color: #5a6268;
}

.card-success .card-header {
    background: #198754;
    color: white;
    border-bottom-color: #157347;
}

.card-danger .card-header {
    background: #dc3545;
    color: white;
    border-bottom-color: #bb2d3b;
}

.card-warning .card-header {
    background: #ffc107;
    color: #212529;
    border-bottom-color: #ffca2c;
}

.card-info .card-header {
    background: #0dcaf0;
    color: #212529;
    border-bottom-color: #3dd5f3;
}

/* Exchange-specific card variants */
.exchange-message-card {
    background-color: var(--bs-tertiary-bg);
    border-radius: 12px;
}

.exchange-message-header {
    background-color: var(--bs-tertiary-bg);
    border-radius: 12px 12px 0 0;
    padding: 16px 20px;
}

/* Card Sizes */
.card-sm {
    max-width: 300px;
}

.card-md {
    max-width: 500px;
}

.card-lg {
    max-width: 800px;
}

.card-xl {
    max-width: 1200px;
}

.card-full {
    width: 100%;
}

/* Card Layouts */
.card-horizontal {
    display: flex;
    flex-direction: row;
}

.card-horizontal .card-header {
    width: 200px;
    border-right: 1px solid;
    border-bottom: none;
}

.card-horizontal .card-body {
    flex: 1;
}

/* Card Grid */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.card-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Card Content */
.card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    opacity: 0.8;
}

.card-text {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.card-text:last-child {
    margin-bottom: 0;
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.card-actions-right {
    justify-content: flex-end;
}

.card-actions-center {
    justify-content: center;
}

.card-actions-between {
    justify-content: space-between;
}

/* Card Media */
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-image-sm {
    height: 120px;
}

.card-image-lg {
    height: 300px;
}

.card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
}

/* Card States */
.card-loading {
    opacity: 0.6;
    pointer-events: none;
}

.card-loading .card-body::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #dee2e6;
    border-top: 2px solid #722F37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.card-error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.card-success {
    border-color: #198754;
    background: rgba(25, 135, 84, 0.05);
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.2s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Card Badges */
.card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #722F37;
    color: white;
}

/* Card List */
.card-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-list-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-list-item:last-child {
    border-bottom: none;
}

.card-list-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Card Collapse */
.card-collapse .card-header {
    cursor: pointer;
    user-select: none;
}

.card-collapse .card-header::after {
    content: '▼';
    float: right;
    transition: transform 0.2s ease;
}

.card-collapse.collapsed .card-header::after {
    transform: rotate(-90deg);
}

.card-collapse.collapsed .card-body {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .card-horizontal {
        flex-direction: column;
    }
    
    .card-horizontal .card-header {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card-actions .theme-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-footer {
        padding: 0.75rem 1rem;
    }
}

/* Animation Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
