/**
 * Midas Card Component System
 * Flexible card layouts for dynamic data templates
 */

/* ==========================================================================
   Base Card
   ========================================================================== */

.midas-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 0 auto;
}

/* Card Sizes */
.midas-card-sm { max-width: 400px; }
.midas-card-md { max-width: 600px; }
.midas-card-lg { max-width: 900px; }
.midas-card-xl { max-width: 1200px; }
.midas-card-full { max-width: 100%; }

/* ==========================================================================
   Card Hero Image
   ========================================================================== */

.midas-card-hero {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.midas-card-hero-sm { max-height: 150px; }
.midas-card-hero-md { max-height: 250px; }
.midas-card-hero-lg { max-height: 400px; }

/* Centered hero (for smaller images) */
.midas-card-hero-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
}

.midas-card-hero-center img {
    max-width: 80%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ==========================================================================
   Card Header
   ========================================================================== */

.midas-card-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.midas-card-header h1,
.midas-card-header h2,
.midas-card-header h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-weight: 600;
}

.midas-card-header h1 { font-size: 1.75rem; }
.midas-card-header h2 { font-size: 1.5rem; }
.midas-card-header h3 { font-size: 1.25rem; }

.midas-card-subtitle {
    margin: 0;
    color: #6c757d;
    font-size: 0.95rem;
}

/* Header with centered text */
.midas-card-header-center {
    text-align: center;
}

/* ==========================================================================
   Card Body
   ========================================================================== */

.midas-card-body {
    padding: 20px;
}

/* Compact body (less padding) */
.midas-card-body-compact {
    padding: 15px;
}

/* ==========================================================================
   Grid Layouts
   ========================================================================== */

.midas-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
}

.midas-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 20px;
}

.midas-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 20px;
}

/* Responsive: Stack on mobile */
@media (max-width: 600px) {
    .midas-grid-2,
    .midas-grid-3,
    .midas-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Key-Value Pairs */
.midas-kv {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.midas-kv-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 2px;
}

.midas-kv-value {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

/* Inline key-value */
.midas-kv-inline {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.midas-kv-inline .midas-kv-label {
    font-size: inherit;
    text-transform: none;
    color: #6c757d;
}

.midas-kv-inline .midas-kv-label::after {
    content: ':';
}

/* ==========================================================================
   Dividers
   ========================================================================== */

.midas-divider {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 15px 0;
}

.midas-divider-thick {
    border-top-width: 2px;
}

/* ==========================================================================
   Card Actions (Button Bar)
   ========================================================================== */

.midas-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.midas-card-actions-center {
    justify-content: center;
}

.midas-card-actions-right {
    justify-content: flex-end;
}

.midas-card-actions-spread {
    justify-content: space-between;
}

/* Action Buttons */
.midas-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.midas-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* Button Variants */
.midas-btn-primary {
    background: #0073aa;
    color: #ffffff;
}

.midas-btn-primary:hover {
    background: #005a87;
    color: #ffffff;
}

.midas-btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.midas-btn-secondary:hover {
    background: #5a6268;
    color: #ffffff;
}

.midas-btn-outline {
    background: transparent;
    border: 1px solid #0073aa;
    color: #0073aa;
}

.midas-btn-outline:hover {
    background: #0073aa;
    color: #ffffff;
}

.midas-btn-ghost {
    background: transparent;
    color: #0073aa;
}

.midas-btn-ghost:hover {
    background: rgba(0, 115, 170, 0.1);
}

/* Button Sizes */
.midas-btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.midas-btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

/* ==========================================================================
   Card Sections
   ========================================================================== */

.midas-card-section {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.midas-card-section:last-child {
    border-bottom: none;
}

.midas-card-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    margin: 0 0 10px 0;
}

/* ==========================================================================
   Embedded Tables
   ========================================================================== */

.midas-card-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.midas-card-table th,
.midas-card-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.midas-card-table th {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.midas-card-table tr:last-child td {
    border-bottom: none;
}

.midas-card-table tr:hover td {
    background: #f8f9fa;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.midas-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.midas-badge-success {
    background: #d4edda;
    color: #155724;
}

.midas-badge-warning {
    background: #fff3cd;
    color: #856404;
}

.midas-badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.midas-badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.midas-badge-neutral {
    background: #e9ecef;
    color: #495057;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Text alignment */
.midas-text-center { text-align: center; }
.midas-text-right { text-align: right; }
.midas-text-left { text-align: left; }

/* Spacing */
.midas-mt-0 { margin-top: 0; }
.midas-mt-1 { margin-top: 10px; }
.midas-mt-2 { margin-top: 20px; }
.midas-mb-0 { margin-bottom: 0; }
.midas-mb-1 { margin-bottom: 10px; }
.midas-mb-2 { margin-bottom: 20px; }
.midas-p-0 { padding: 0; }
.midas-p-1 { padding: 10px; }
.midas-p-2 { padding: 20px; }

/* Display */
.midas-hidden { display: none; }
.midas-flex { display: flex; }
.midas-flex-center { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

/* Colors */
.midas-text-muted { color: #6c757d; }
.midas-text-primary { color: #0073aa; }
.midas-text-success { color: #28a745; }
.midas-text-danger { color: #dc3545; }

/* ==========================================================================
   Dark Mode Support (optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .midas-card-dark {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .midas-card-dark .midas-card-header {
        border-color: #404040;
    }
    
    .midas-card-dark .midas-card-header h1,
    .midas-card-dark .midas-card-header h2,
    .midas-card-dark .midas-card-header h3 {
        color: #e0e0e0;
    }
    
    .midas-card-dark .midas-card-actions {
        background: #252525;
        border-color: #404040;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .midas-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .midas-card-actions {
        display: none;
    }
    
    .midas-btn {
        display: none;
    }
}
