/* ============================================
   V+M Design System v3.2.0 - Component Styles
   ============================================
   COMPLETE styling for ALL 21 core components
   AI Agents: Use these EXACT styles - do not create custom CSS
   ============================================ */

/* ==========================================
   1. HEADERS
   ========================================== */
.header {
    background: linear-gradient(135deg, var(--vm-red) 0%, var(--vm-red-dark) 100%);
    color: var(--vm-header-text-color, var(--vm-white));
    padding: var(--space-xs) 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    padding: var(--space-md) 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header-text h1 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 700;
    margin: 0;
    color: var(--vm-header-text-color, var(--vm-white));
    text-shadow: var(--vm-text-shadow-md);
    text-transform: uppercase;
    letter-spacing: var(--vm-typography-letter-spacing-wide);
    line-height: var(--vm-typography-line-height-tight);
}

.header-subtitle {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    opacity: 0.9;
    margin-top: var(--space-xs);
    color: var(--vm-header-subtitle-color, var(--vm-text-on-dark));
    text-shadow: var(--vm-text-shadow-sm);
}

/* ==========================================
   2. NAVIGATION
   ========================================== */
.navigation {
    background: var(--vm-surface-muted-bg);
    border-bottom: 1px solid var(--vm-surface-card-border);
    position: sticky;
    top: 0;
    z-index: var(--vm-z-index-sticky);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--space-xl);
    padding: var(--space-md) 0;
    margin: 0;
}

.nav-link {
    color: var(--vm-gray-600);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
    color: var(--vm-red);
    background: color-mix(in srgb, var(--vm-red) 10%, transparent);
}

/* ==========================================
   3. MAIN CONTENT & SECTIONS
   ========================================== */
.main-content {
    padding: var(--space-xxl) 0;
    min-height: calc(100vh - 200px);
}

.section {
    margin-bottom: var(--space-xxxl);
}

.section h2 {
    font-family: var(--font-primary);
    font-size: var(--vm-typography-font-size-xl);
    font-weight: var(--vm-typography-font-weight-semibold);
    color: var(--vm-gray-800);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--vm-red);
    letter-spacing: var(--vm-typography-letter-spacing-wide);
    display: inline-block;
}

.section p {
    font-size: 1rem;
    color: var(--vm-gray-600);
    margin-bottom: var(--space-xl);
    line-height: 1.7;
}

/* ==========================================
   4. CARDS
   ========================================== */
.card {
    background: var(--vm-surface-card-bg);
    border: 1px solid var(--vm-surface-card-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h3 {
    color: var(--vm-gray-800);
    margin-bottom: var(--space-md);
    font-size: 1.25rem;
}

.card p {
    color: var(--vm-gray-600);
    line-height: 1.6;
}

/* ==========================================
   5. KPI CARDS
   ========================================== */
.kpi-card {
    background: var(--vm-white);
    border: 1px solid var(--vm-gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    text-align: center;
}

.kpi-card:hover {
    border-color: var(--vm-red);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kpi-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--vm-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--vm-gray-800);
    margin-bottom: var(--space-sm);
}

.kpi-trend {
    display: inline-block;
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.trend-up {
    background: color-mix(in srgb, var(--success) 20%, transparent);
    color: var(--success-dark);
}

.trend-down {
    background: color-mix(in srgb, var(--error) 20%, transparent);
    color: var(--error-dark);
}

.trend-flat {
    background: color-mix(in srgb, var(--vm-gray-500) 10%, transparent);
    color: var(--vm-gray-400);
}

/* ==========================================
   6. TABLES
   ========================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--vm-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th {
    background: linear-gradient(135deg, var(--vm-red), var(--vm-red-dark));
    color: var(--vm-white);
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table th.text-center,
.table td.text-center {
    text-align: center;
}

.table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--vm-gray-100);
    color: var(--vm-gray-700);
}

.table tbody tr:nth-child(odd) {
    background: var(--vm-white);
}

.table tbody tr:nth-child(even) {
    background: var(--vm-gray-50);
}

.table tbody tr:hover {
    background: var(--vm-gray-100);
}

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

[data-theme="dark"] .table {
    background: var(--vm-surface-card-bg);
    box-shadow: var(--vm-box-shadow-md);
}

[data-theme="dark"] .table th {
    background: linear-gradient(135deg, var(--vm-red-dark), var(--vm-red));
    border-bottom: 1px solid var(--vm-color-border-secondary);
}

[data-theme="dark"] .table td {
    color: var(--vm-color-text-primary);
    border-bottom: 1px solid var(--vm-color-border-secondary);
}

[data-theme="dark"] .table tbody tr:nth-child(odd) {
    background: color-mix(in srgb, var(--vm-surface-card-bg) 92%, rgba(255, 255, 255, 0.08) 8%);
}

[data-theme="dark"] .table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--vm-surface-card-bg) 85%, rgba(255, 255, 255, 0.15) 15%);
}

[data-theme="dark"] .table tbody tr:hover {
    background: color-mix(in srgb, var(--vm-red) 14%, var(--vm-surface-card-bg) 86%);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================
   7. BADGES
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 2rem;
    line-height: 1.5;
}

.badge-primary {
    background: var(--vm-red);
    color: var(--vm-white);
}

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

.badge-warning {
    background: var(--warning);
    color: var(--vm-white);
}

.badge-danger {
    background: var(--error);
    color: var(--vm-white);
}

.badge-info {
    background: var(--info);
    color: var(--vm-white);
}

.badge-secondary {
    background: var(--vm-gray-400);
    color: var(--vm-white);
}

.badge-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ==========================================
   8. ALERTS
   ========================================== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.alert-success {
    background: color-mix(in srgb, var(--success) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--success-dark);
}

.alert-warning {
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    color: var(--warning-dark);
}

.alert-danger {
    background: color-mix(in srgb, var(--error) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
    color: var(--error-dark);
}

.alert-info {
    background: color-mix(in srgb, var(--info) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
    color: var(--info-dark);
}

/* Dark mode adjustment for info alert - unified with design-tokens.css */
[data-theme="dark"] .alert-info {
    background: color-mix(in srgb, var(--info) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--info) 40%, transparent);
    color: var(--info-text); /* Uses unified design system variable for dark mode text */
}

.flash-message {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

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

.flash-error {
    background: var(--error);
    color: var(--vm-white);
}

/* ==========================================
   9. MODALS
   ========================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--vm-black) 50%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--vm-z-index-modal);
}

.modal {
    background: var(--vm-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--vm-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--vm-gray-800);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--vm-gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--vm-gray-400);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   10. LOADING STATES
   ========================================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--vm-gray-200);
    border-top-color: var(--vm-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--space-lg) auto;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

.loading-text {
    text-align: center;
    color: var(--vm-gray-600);
    margin-top: var(--space-md);
}

/* ==========================================
   11. EMPTY STATES
   ========================================== */
.empty-state {
    text-align: center;
    padding: var(--space-xxl);
    color: var(--vm-gray-400);
}

.empty-state i {
    color: var(--vm-gray-300);
    margin-bottom: var(--space-lg);
}

.empty-state h3 {
    color: var(--vm-gray-600);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--vm-gray-500);
    margin-bottom: var(--space-lg);
}

/* ==========================================
   12. GRIDS
   ========================================== */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ==========================================
   13. TYPOGRAPHY UTILITIES
   ========================================== */
.lead {
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.6;
    color: var(--vm-gray-700);
}

.text-small {
    font-size: 0.875rem;
    color: var(--vm-gray-600);
}

.text-muted {
    color: var(--vm-gray-400);
}

/* ==========================================
   14. COLOR SWATCHES (for Component Library)
   ========================================== */
.color-swatch {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-shadow: var(--vm-text-shadow-sm);
    color: var(--vm-white);
}

/* ==========================================
   15. BUTTON GROUPS
   ========================================== */
.button-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

/* ==========================================
   16. LOGO SIZES
   ========================================== */
.vm-logo {
    display: block;
    max-width: 100%;
    height: auto;
    transition: opacity var(--transition-base);
}

.vm-logo:hover {
    opacity: var(--vm-state-hover-opacity);
}

/* Logo size classes */
.vm-logo-xs {
    width: 80px;
    height: auto;
}

.vm-logo-sm {
    width: 120px;
    height: auto;
}

.vm-logo-md {
    width: 180px;
    height: auto;
}

.vm-logo-lg {
    width: 240px;
    height: auto;
}

.vm-logo-xl {
    width: 300px;
    height: auto;
}

/* White logo variant for dark backgrounds */
.vm-logo-white {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .nav-list {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .modal {
        width: 95%;
        margin: var(--space-md);
    }
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
    margin-top: var(--space-xxl);
    background: var(--vm-gray-900);
    color: var(--vm-white);
    padding: var(--space-lg);
    text-align: center;
}

.footer p {
    margin: 0;
    color: var(--vm-white);
    opacity: 0.9;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-center {
    text-align: center;
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--vm-red);
    outline-offset: 2px;
}

/* ==========================================
   17. SIDEBAR
   ========================================== */
.sidebar {
    width: var(--vm-component-sidebar-width, 280px);
    background: var(--vm-surface-muted-bg);
    border-right: 1px solid var(--vm-surface-card-border);
    min-height: 100vh;
    padding: var(--space-lg);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin-bottom: var(--space-xs);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--vm-gray-600);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.sidebar-link:hover,
.sidebar-item.active .sidebar-link {
    background: color-mix(in srgb, var(--vm-red) 10%, transparent);
    color: var(--vm-red);
}

/* ==========================================
   18. PAGINATION
   ========================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    justify-content: center;
    margin: var(--space-lg) 0;
}

.pagination-prev,
.pagination-next,
.pagination-number {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--vm-gray-300);
    background: var(--vm-white);
    color: var(--vm-gray-700);
    text-decoration: none;
    border-radius: var(--radius-md);
    min-width: 2.5rem;
    text-align: center;
    transition: all var(--transition-base);
}

.pagination-number:hover,
.pagination-prev:hover:not([disabled]),
.pagination-next:hover:not([disabled]) {
    background: var(--vm-red);
    color: var(--vm-white);
    border-color: var(--vm-red);
}

.pagination-number.active {
    background: var(--vm-red);
    color: var(--vm-white);
    border-color: var(--vm-red);
}

.pagination-prev[disabled],
.pagination-next[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   19. BREADCRUMBS
   ========================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: var(--vm-typography-font-size-sm);
}

.breadcrumb-item {
    color: var(--vm-gray-600);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb-item:hover:not(.active) {
    color: var(--vm-red);
}

.breadcrumb-item.active {
    color: var(--vm-gray-800);
    font-weight: var(--vm-typography-font-weight-semibold);
}

.breadcrumb-separator {
    margin: 0 var(--space-sm);
    color: var(--vm-gray-400);
}

/* ==========================================
   20. TABS
   ========================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--vm-gray-200);
    margin-bottom: var(--space-lg);
}

.tab-button {
    padding: var(--space-sm) var(--space-lg);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--vm-gray-600);
    font-weight: var(--vm-typography-font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--vm-red);
}

.tab-button.active {
    color: var(--vm-red);
    border-bottom-color: var(--vm-red);
}

.tab-content {
    padding: var(--space-lg) 0;
}

/* ==========================================
   21. TOAST NOTIFICATIONS
   ========================================== */
.toast {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--vm-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    z-index: var(--vm-z-index-notification);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toast-success {
    border-left: 4px solid var(--success);
    color: var(--success-dark);
}

.toast-error {
    border-left: 4px solid var(--error);
    color: var(--error-dark);
}

.toast-warning {
    border-left: 4px solid var(--warning);
    color: var(--warning-dark);
}

.toast-info {
    border-left: 4px solid var(--info);
    color: var(--info-dark);
}

/* ==========================================
   DEMO HELPERS (Component Library Only)
   ========================================== */
.demo-preview {
    border: 1px solid var(--vm-gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-md);
}

.theme-toggle {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: var(--vm-z-index-dropdown);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
