/**
 * HubSpot-Style Mobile Components Library
 * Reusable, accessible, production-ready components
 */

/* ===================================
   CARDS
   =================================== */

.hs-card {
    background: #ffffff;
    border-radius: 8px;
    padding: var(--space-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.hs-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.hs-card--metric {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.hs-card__label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hs-card__value {
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    line-height: 1.2;
}

.hs-card__change {
    font-size: var(--text-sm);
    font-weight: 500;
}

.hs-card__change--positive {
    color: #059669;
}

.hs-card__change--negative {
    color: #EF4444;
}

.hs-card__footer {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: var(--text-sm);
    color: #6B7280;
}

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

.hs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: var(--touch-target-min);
    -webkit-tap-highlight-color: transparent;
}

.hs-btn--primary {
    background: #FF7A59;
    color: #ffffff;
}

.hs-btn--primary:hover {
    background: #FF6842;
}

.hs-btn--primary:active {
    transform: scale(0.98);
}

.hs-btn--secondary {
    background: #F3F4F6;
    color: #1F2937;
}

.hs-btn--secondary:hover {
    background: #E5E7EB;
}

.hs-btn--outline {
    background: transparent;
    border: 1px solid #D1D5DB;
    color: #1F2937;
}

.hs-btn--outline:hover {
    background: #F9FAFB;
}

.hs-btn--sm {
    padding: 8px 16px;
    font-size: var(--text-xs);
}

.hs-btn--lg {
    padding: 16px 24px;
    font-size: var(--text-base);
}

.hs-btn--full {
    width: 100%;
}

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

/* ===================================
   FORMS
   =================================== */

.hs-form-group {
    margin-bottom: var(--space-md);
}

.hs-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: #374151;
    margin-bottom: var(--space-xs);
}

.hs-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px; /* Prevents iOS zoom */
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.2s ease;
    min-height: var(--touch-target-min);
}

.hs-input:focus {
    outline: none;
    border-color: #FF7A59;
    box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.1);
}

.hs-input::placeholder {
    color: #9CA3AF;
}

.hs-input--error {
    border-color: #EF4444;
}

.hs-form-error {
    font-size: var(--text-xs);
    color: #EF4444;
    margin-top: var(--space-xs);
}

.hs-select {
    appearance: none;
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #ffffff url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236B7280' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
    cursor: pointer;
    min-height: var(--touch-target-min);
}

/* ===================================
   MODALS
   =================================== */

.hs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hs-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.hs-modal {
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.hs-modal-overlay.active .hs-modal {
    transform: translateY(0);
}

.hs-modal__header {
    padding: var(--space-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hs-modal__title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #1F2937;
}

.hs-modal__close {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.hs-modal__close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hs-modal__body {
    padding: var(--space-md);
}

.hs-modal__footer {
    padding: var(--space-md);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: var(--space-sm);
}

/* Desktop Modal */
@media (min-width: 768px) {
    .hs-modal-overlay {
        align-items: center;
    }
    
    .hs-modal {
        border-radius: 16px;
        max-width: 500px;
        max-height: 80vh;
        transform: scale(0.9);
        opacity: 0;
    }
    
    .hs-modal-overlay.active .hs-modal {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================
   LIST ITEMS
   =================================== */

.hs-list {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

.hs-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease;
    text-decoration: none;
    color: inherit;
    min-height: var(--touch-target-min);
}

.hs-list-item:last-child {
    border-bottom: none;
}

.hs-list-item:active {
    background: rgba(0, 0, 0, 0.03);
}

.hs-list-item__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hs-list-item__content {
    flex: 1;
    min-width: 0;
}

.hs-list-item__title {
    font-weight: 500;
    color: #1F2937;
    margin-bottom: 2px;
}

.hs-list-item__subtitle {
    font-size: var(--text-sm);
    color: #6B7280;
}

.hs-list-item__action {
    flex-shrink: 0;
}

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

.hs-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: 12px;
    white-space: nowrap;
}

.hs-badge--primary {
    background: #DBEAFE;
    color: #1E40AF;
}

.hs-badge--success {
    background: #D1FAE5;
    color: #065F46;
}

.hs-badge--warning {
    background: #FEF3C7;
    color: #92400E;
}

.hs-badge--danger {
    background: #FEE2E2;
    color: #991B1B;
}

/* ===================================
   DARK MODE
   =================================== */

[data-theme="dark"] .hs-card {
    background: #1F2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .hs-card__label {
    color: #9CA3AF;
}

[data-theme="dark"] .hs-card__value {
    color: #F9FAFB;
}

[data-theme="dark"] .hs-input,
[data-theme="dark"] .hs-select {
    background: #374151;
    border-color: #4B5563;
    color: #F9FAFB;
}

[data-theme="dark"] .hs-modal {
    background: #1F2937;
}

[data-theme="dark"] .hs-list {
    background: #1F2937;
}

[data-theme="dark"] .hs-list-item {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .hs-list-item__title {
    color: #F9FAFB;
}
