/* ============================================
   JAÉN SPORTS — Component Library
   Buttons, Cards, Forms, Modals, Chat, etc.
   ============================================ */

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 28px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    color: var(--color-white);
    box-shadow: 0 4px 14px rgba(26, 86, 219, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 86, 219, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-primary-500);
    border-color: var(--color-primary-200);
}

.btn-secondary:hover {
    background: var(--color-primary-50);
    border-color: var(--color-primary-400);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: var(--color-white);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-ghost {
    background: transparent;
    color: var(--color-gray-600);
}

.btn-ghost:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-900);
}

.btn-sm {
    padding: 8px 18px;
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 16px 36px;
    font-size: var(--text-base);
    border-radius: var(--radius-xl);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ========== CARDS ========== */
.card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-gray-200);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-body {
    padding: var(--space-6);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Match Card */
.match-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-gray-200);
    padding: var(--space-6);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.match-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius-full);
}

.match-card[data-sport="futsal"]::before {
    background: var(--color-futsal);
}

.match-card[data-sport="futbol11"]::before {
    background: var(--color-futbol11);
}

.match-card[data-sport="padel"]::before {
    background: var(--color-padel);
}

.match-card[data-sport="basket"]::before {
    background: var(--color-basket);
}

.match-card[data-sport="tenis"]::before {
    background: var(--color-tenis);
}

.match-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-200);
}

.match-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.sport-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sport-badge.futsal {
    background: rgba(26, 86, 219, 0.1);
    color: var(--color-futsal);
}

.sport-badge.futbol11 {
    background: rgba(5, 150, 105, 0.1);
    color: var(--color-futbol11);
}

.sport-badge.padel {
    background: rgba(124, 58, 237, 0.1);
    color: var(--color-padel);
}

.sport-badge.basket {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-basket);
}

.sport-badge.tenis {
    background: rgba(217, 119, 6, 0.1);
    color: var(--color-tenis);
}

.match-card-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-gray-900);
    margin-bottom: var(--space-3);
}

.match-card-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.match-card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-gray-500);
}

.match-card-meta-item svg {
    width: 16px;
    height: 16px;
    color: var(--color-gray-400);
    flex-shrink: 0;
}

.match-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}

.spots-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.spots-bar {
    width: 100px;
    height: 6px;
    background: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.spots-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    transition: width var(--transition-slow);
}

.spots-bar-fill.almost-full {
    background: var(--color-warning);
}

.spots-bar-fill.full {
    background: var(--color-error);
}

.spots-text {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-gray-500);
}

.price-tag {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--color-primary-900);
}

.price-tag small {
    font-size: var(--text-xs);
    font-weight: var(--weight-regular);
    color: var(--color-gray-500);
}

/* Feature Card */
.feature-card {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    text-align: center;
    transition: all var(--transition-base);
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-200);
}

.feature-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-5);
    border-radius: var(--radius-xl);
    background: var(--color-primary-50);
    color: var(--color-primary-500);
}

.feature-icon svg {
    width: 28px;
    height: 28px;
}

.feature-card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
}

.feature-card p {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* Facility Card */
.facility-card {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
}

.facility-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.facility-card-img {
    height: 180px;
    width: 100%;
    object-fit: cover;
}

.facility-card-body {
    padding: var(--space-5);
}

.facility-card-body h4 {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
}

.facility-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.facility-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 10px;
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    color: var(--color-gray-600);
}

.facility-tag svg {
    width: 12px;
    height: 12px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--text-sm);
    color: var(--color-gray-900);
    background: var(--color-white);
    border: 1.5px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition-medium);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    min-height: 48px;
    line-height: 1.5;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--color-gray-300);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-input.error {
    border-color: var(--color-error);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-error);
    margin-top: var(--space-1);
}

/* Custom premium styling for Date and Time pickers */
input[type="date"],
input[type="time"] {
    position: relative;
    font-family: inherit;
    color: var(--color-gray-900);
    background-color: var(--color-white);
    cursor: pointer;
    text-transform: uppercase;
    /* Makes the placeholder text look cleaner */
    min-height: 48px;
    display: block;
    /* fix for chrome vertical alignment */
}

/* Ensure placeholder text matches the rest of the inputs if native */
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit {
    color: var(--color-gray-700);
    padding: 0;
}

/* The calendar icon container */
::-webkit-calendar-picker-indicator {
    background-color: var(--color-gray-50);
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-200);
    color: var(--color-gray-600);
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

::-webkit-calendar-picker-indicator:hover {
    background-color: var(--color-primary-50);
    border-color: var(--color-primary-200);
    color: var(--color-primary-600);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--color-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l4-4 4 4m0 6l-4 4-4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

.form-select:hover {
    border-color: var(--color-gray-400);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.form-select:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background-color: var(--color-white);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary-500);
}