/**
 * CyclistsHub Design System - Component Library
 * Version: 1.0
 * Date: 2026-03-09
 *
 * ⚠️ MASTER COPY - This is the source of truth
 * Location: _design-system/ch-components.css
 *
 * When starting a new project:
 * 1. Copy this file to your project folder
 * 2. Customize as needed for your project
 * 3. Each project maintains its own independent copy
 *
 * Prerequisites: ch-variables.css must be imported first
 *
 * Import order:
 * <link rel="stylesheet" href="ch-variables.css">
 * <link rel="stylesheet" href="ch-components.css">
 */

/* ===================================
   BUTTONS
   =================================== */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary {
    background: var(--color-main);
    color: #ffffff;
}

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

.btn-secondary {
    background: var(--color-main);
    color: #ffffff;
}

.btn-secondary:hover {
    background: var(--color-medium);
}

.btn-cta {
    background: var(--color-cta);
    color: #ffffff;
}

.btn-cta:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--color-cta);
    color: #ffffff;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    color: var(--color-main);
    border: 1px solid var(--color-main);
}

.btn-outline:hover {
    background: var(--color-main);
    color: #ffffff;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================================
   FORM INPUTS
   =================================== */

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0;
    font-size: 0.9rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--color-text);
    width: 100%;
    transition: border-color 0.2s;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-medium);
}

.input:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    background: var(--color-hover);
    cursor: not-allowed;
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.input-sm {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.input-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-group .help-text {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Checkboxes and Radio Buttons */
.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===================================
   TABLES
   =================================== */

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.table th {
    background: var(--color-main);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.table td {
    font-size: 0.9rem;
    color: var(--color-text);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.table tbody tr:hover td {
    background: var(--color-hover);
}

.table-striped tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.table-bordered {
    border: 1px solid var(--color-border);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--color-border);
}

/* Sticky First Column */
.table-sticky-first th:first-child,
.table-sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
}

.table-sticky-first th:first-child {
    z-index: 3;
    background: var(--color-main);
}

.table-sticky-first tbody tr:hover td:first-child {
    background: var(--color-hover);
}

/* ===================================
   CARDS & SECTIONS
   =================================== */

.section {
    background: #ffffff;
    border-radius: 0;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

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

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-main);
    margin: 0;
}

.section-subtitle {
    font-size: 0.9rem;
    color: var(--color-main);
    margin-top: 0.25rem;
}

/* ===================================
   UPLOAD AREA
   =================================== */

.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: 0;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--color-light);
}

.upload-area:hover {
    border-color: var(--color-medium);
}

.upload-area.drag-over {
    border-color: var(--color-cta);
    background: #fff0f5;
}

.upload-area-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-area-icon {
    font-size: 3rem;
    color: var(--color-medium);
}

.upload-area-content p {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.upload-area-content .btn {
    margin-top: 0.5rem;
}

/* ===================================
   FILE LIST
   =================================== */

.file-list {
    display: grid;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--color-hover);
    border-radius: 0;
    border-left: 4px solid var(--color-main);
}

.file-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-main);
}

.file-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.file-details p {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

/* Color Indicators */
.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===================================
   ALERTS & NOTIFICATIONS
   =================================== */

.alert {
    padding: 1rem;
    border-radius: 0;
    border-left: 4px solid;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-info {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #075985;
}

.alert-success {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-danger {
    background: #fee;
    border-color: var(--color-cta);
    color: #991b1b;
}

/* ===================================
   BADGES
   =================================== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--color-main);
    color: #ffffff;
}

.badge-secondary {
    background: var(--color-text-light);
    color: #ffffff;
}

.badge-success {
    background: #10b981;
    color: #ffffff;
}

.badge-warning {
    background: #f59e0b;
    color: #ffffff;
}

.badge-danger {
    background: var(--color-cta);
    color: #ffffff;
}

/* ===================================
   LOADING STATES
   =================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-main);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

/* Loading Overlay */
.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;
}

/* ===================================
   HEADER
   =================================== */

.header {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-logo {
    height: 60px;
    width: auto;
    display: block;
    transition: opacity 0.2s;
}

.header-logo:hover {
    opacity: 0.8;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-main);
    line-height: 1.2;
    margin: 0;
}

.header p {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */

@media (max-width: 767px) {
    .section {
        padding: 0.75rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .header-logo {
        height: 40px;
    }

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

    .upload-area {
        padding: 2rem 1rem;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-logo {
        height: 35px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .table th,
    .table td {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
}
