/* components.css - Global UI Components Design System */

/* ==========================================================================
   1. BUTTONS
   ========================================================================== */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-default);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn i {
    font-size: 1.1em;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--clr-accent-m) 0%, var(--clr-accent-d) 100%);
    color: white;
    box-shadow: 0 4px 15px hsla(var(--clr-accent-hue), 70%, 40%, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(var(--clr-accent-hue), 70%, 40%, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background-color: var(--clr-bg-light);
    color: var(--clr-text-primary);
    border: 1px solid var(--clr-border);
}

.btn-secondary:hover {
    background-color: var(--clr-bg-medium);
    border-color: var(--clr-border-light);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--clr-accent-l);
    border: 1px solid var(--clr-accent-m);
}

.btn-outline:hover {
    background-color: hsla(var(--clr-accent-hue), 70%, 50%, 0.1);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--clr-text-secondary);
}

.btn-ghost:hover {
    background-color: var(--clr-bg-light);
    color: var(--clr-text-primary);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, var(--clr-red-m) 0%, var(--clr-red-d) 100%);
    color: white;
    box-shadow: 0 4px 15px hsla(var(--clr-red-hue), 70%, 40%, 0.35);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(var(--clr-red-hue), 70%, 40%, 0.45);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--clr-green-m) 0%, var(--clr-green-d) 100%);
    color: white;
    box-shadow: 0 4px 15px hsla(var(--clr-green-hue), 60%, 35%, 0.35);
}

.btn-success:hover {
    transform: translateY(-2px);
}

/* Button Sizes */
.btn-xs {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
}

.btn-sm {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 16px 32px;
    font-size: var(--font-size-lg);
}

/* Icon Only Button */
.btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
    padding: 6px;
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
    padding: 12px;
}

/* Full Width Button */
.btn-block {
    width: 100%;
}

/* ==========================================================================
   2. FORM INPUTS
   ========================================================================== */

/* Input Group Container */
.form-group {
    margin-bottom: var(--spacing-lg);
}

/* Labels */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--clr-text-secondary);
}

.form-label.required::after {
    content: " *";
    color: var(--clr-red-m);
}

/* Base Input Style */
.form-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--clr-bg-dark);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-default);
    color: var(--clr-text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
    line-height: 1.5;
}

.form-input::placeholder {
    color: var(--clr-text-tertiary);
}

.form-input:hover {
    border-color: var(--clr-border-light);
}

.form-input:focus {
    outline: none;
    border-color: var(--clr-accent-m);
    background-color: var(--clr-bg-medium);
    box-shadow: 0 0 0 4px hsla(var(--clr-accent-hue), 70%, 60%, 0.15);
}

/* Input with Icon */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .input-icon-left {
    position: absolute;
    left: 14px;
    color: var(--clr-text-tertiary);
    font-size: 1.2rem;
    pointer-events: none;
    transition: color 0.2s;
}

.input-icon-wrapper .input-icon-right {
    position: absolute;
    right: 14px;
    color: var(--clr-text-tertiary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.input-icon-wrapper .input-icon-right:hover {
    color: var(--clr-text-primary);
}

.input-icon-wrapper .form-input.has-icon-left {
    padding-left: 44px;
}

.input-icon-wrapper .form-input.has-icon-right {
    padding-right: 44px;
}

.input-icon-wrapper:focus-within .input-icon-left {
    color: var(--clr-accent-m);
}

/* Input Sizes */
.form-input.input-sm {
    padding: 8px 12px;
    font-size: var(--font-size-sm);
}

.form-input.input-lg {
    padding: 16px 20px;
    font-size: var(--font-size-lg);
}

/* Input States */
.form-input.is-valid {
    border-color: var(--clr-green-m);
}

.form-input.is-valid:focus {
    box-shadow: 0 0 0 4px hsla(var(--clr-green-hue), 70%, 50%, 0.15);
}

.form-input.is-invalid {
    border-color: var(--clr-red-m);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 4px hsla(var(--clr-red-hue), 70%, 50%, 0.15);
}

/* Help Text */
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: var(--font-size-xs);
    color: var(--clr-text-tertiary);
}

.form-hint.is-error {
    color: var(--clr-red-l);
}

.form-hint.is-success {
    color: var(--clr-green-l);
}

/* Textarea */
.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ==========================================================================
   3. SELECT / DROPDOWN
   ========================================================================== */

.form-select {
    width: 100%;
    padding: 12px 44px 12px 16px;
    background-color: var(--clr-bg-dark);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-default);
    color: var(--clr-text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: all 0.2s ease;
}

.form-select:hover {
    border-color: var(--clr-border-light);
}

.form-select:focus {
    outline: none;
    border-color: var(--clr-accent-m);
    box-shadow: 0 0 0 4px hsla(var(--clr-accent-hue), 70%, 60%, 0.15);
}

.form-select option {
    background-color: var(--clr-bg-base);
    color: var(--clr-text-primary);
    padding: 10px;
}

/* ==========================================================================
   4. CHECKBOX
   ========================================================================== */

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.form-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-mark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--clr-border-light);
    border-radius: var(--radius-xs);
    background-color: var(--clr-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.checkbox-mark::after {
    content: "";
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
    margin-top: -2px;
}

.form-checkbox:hover .checkbox-mark {
    border-color: var(--clr-accent-m);
}

.form-checkbox input:checked + .checkbox-mark {
    background: linear-gradient(135deg, var(--clr-accent-m) 0%, var(--clr-accent-d) 100%);
    border-color: var(--clr-accent-m);
}

.form-checkbox input:checked + .checkbox-mark::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-label {
    color: var(--clr-text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

.checkbox-label a {
    color: var(--clr-accent-l);
    text-decoration: underline;
}

/* ==========================================================================
   5. RADIO BUTTONS
   ========================================================================== */

.form-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.form-radio input[type="radio"] {
    display: none;
}

.radio-mark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--clr-border-light);
    border-radius: 50%;
    background-color: var(--clr-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-mark::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    transform: scale(0);
    transition: transform 0.15s ease;
}

.form-radio:hover .radio-mark {
    border-color: var(--clr-accent-m);
}

.form-radio input:checked + .radio-mark {
    background: linear-gradient(135deg, var(--clr-accent-m) 0%, var(--clr-accent-d) 100%);
    border-color: var(--clr-accent-m);
}

.form-radio input:checked + .radio-mark::after {
    transform: scale(1);
}

.radio-label {
    color: var(--clr-text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

/* ==========================================================================
   6. TOGGLE / SWITCH
   ========================================================================== */

.form-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.form-toggle input[type="checkbox"] {
    display: none;
}

.toggle-track {
    width: 50px;
    height: 28px;
    background-color: var(--clr-bg-medium);
    border: 1px solid var(--clr-border);
    border-radius: 14px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-thumb {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, white 0%, #e0e0e0 100%);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.form-toggle:hover .toggle-track {
    border-color: var(--clr-border-light);
}

.form-toggle input:checked + .toggle-track {
    background: linear-gradient(135deg, var(--clr-accent-m) 0%, var(--clr-accent-d) 100%);
    border-color: var(--clr-accent-m);
}

.form-toggle input:checked + .toggle-track .toggle-thumb {
    left: 24px;
}

.toggle-label {
    color: var(--clr-text-secondary);
    font-size: var(--font-size-base);
}

/* ==========================================================================
   7. SEARCH BAR
   ========================================================================== */

.search-bar {
    display: flex;
    gap: var(--spacing-xs);
}

.search-bar-input {
    flex: 1;
    position: relative;
}

.search-bar-input .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--clr-text-tertiary);
    font-size: 1.2rem;
    pointer-events: none;
    transition: color 0.2s;
}

.search-bar-input input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background-color: var(--clr-bg-dark);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-default);
    color: var(--clr-text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.search-bar-input input::placeholder {
    color: var(--clr-text-tertiary);
}

.search-bar-input input:focus {
    outline: none;
    border-color: var(--clr-accent-m);
    background-color: var(--clr-bg-medium);
    box-shadow: 0 0 0 4px hsla(var(--clr-accent-hue), 70%, 60%, 0.15);
}

.search-bar-input:focus-within .search-icon {
    color: var(--clr-accent-m);
}

.search-bar-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--clr-accent-m) 0%, var(--clr-accent-d) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-default);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px hsla(var(--clr-accent-hue), 70%, 40%, 0.35);
}

/* ==========================================================================
   8. BADGES / TAGS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background-color: hsla(var(--clr-accent-hue), 70%, 50%, 0.15);
    color: var(--clr-accent-l);
    border: 1px solid hsla(var(--clr-accent-hue), 70%, 50%, 0.3);
}

.badge-success {
    background-color: hsla(var(--clr-green-hue), 60%, 45%, 0.15);
    color: var(--clr-green-l);
    border: 1px solid hsla(var(--clr-green-hue), 60%, 45%, 0.3);
}

.badge-warning {
    background-color: hsla(var(--clr-yellow-hue), 80%, 50%, 0.15);
    color: var(--clr-yellow-l);
    border: 1px solid hsla(var(--clr-yellow-hue), 80%, 50%, 0.3);
}

.badge-danger {
    background-color: hsla(var(--clr-red-hue), 70%, 50%, 0.15);
    color: var(--clr-red-l);
    border: 1px solid hsla(var(--clr-red-hue), 70%, 50%, 0.3);
}

.badge-info {
    background-color: hsla(var(--clr-blue-hue), 70%, 50%, 0.15);
    color: var(--clr-blue-l);
    border: 1px solid hsla(var(--clr-blue-hue), 70%, 50%, 0.3);
}

.badge-neutral {
    background-color: var(--clr-bg-light);
    color: var(--clr-text-secondary);
    border: 1px solid var(--clr-border);
}

/* ==========================================================================
   9. CARDS
   ========================================================================== */

.card {
    background-color: var(--clr-bg-base);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--clr-border-light);
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--clr-border-dark);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--clr-border-dark);
    background-color: var(--clr-bg-dark);
}

/* ==========================================================================
   10. ALERTS
   ========================================================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: var(--spacing-md);
    border-radius: var(--radius-default);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.alert i {
    font-size: 1.3rem;
    margin-top: 1px;
}

.alert-info {
    background-color: hsla(var(--clr-blue-hue), 50%, 15%, 1);
    border: 1px solid hsla(var(--clr-blue-hue), 50%, 30%, 1);
    color: var(--clr-blue-l);
}

.alert-success {
    background-color: hsla(var(--clr-green-hue), 40%, 12%, 1);
    border: 1px solid hsla(var(--clr-green-hue), 40%, 25%, 1);
    color: var(--clr-green-l);
}

.alert-warning {
    background-color: hsla(var(--clr-yellow-hue), 50%, 12%, 1);
    border: 1px solid hsla(var(--clr-yellow-hue), 50%, 30%, 1);
    color: var(--clr-yellow-l);
}

.alert-danger {
    background-color: hsla(var(--clr-red-hue), 40%, 12%, 1);
    border: 1px solid hsla(var(--clr-red-hue), 40%, 25%, 1);
    color: var(--clr-red-l);
}

/* ==========================================================================
   11. TOOLTIPS
   ========================================================================== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    padding: 8px 12px;
    background-color: var(--clr-bg-overlay);
    color: var(--clr-text-primary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* ==========================================================================
   12. LOADING SPINNER
   ========================================================================== */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--clr-border);
    border-top-color: var(--clr-accent-m);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   13. RESPONSIVE UTILITIES
   ========================================================================== */

@media (max-width: 768px) {
    .btn {
        padding: 10px 20px;
    }

    .btn-lg {
        padding: 14px 24px;
    }

    .form-input,
    .form-select {
        padding: 10px 14px;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar-btn {
        width: 100%;
        justify-content: center;
    }
}
