/* Cool Graphite + Indigo Accent — updated 2026-06-26 */
/* ============================================================================
   StudyHub - Forms CSS
   Complete form styling for inputs, selects, buttons, and validation
   ============================================================================ */

/* ==========================================
   FORM GROUPS & LAYOUT
   ========================================== */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* ==========================================
   LABELS
   ========================================== */
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #A1A1AA;
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
    font-weight: 700;
}

/* ==========================================
   TEXT INPUTS
   ========================================== */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: #FAFAFA;
    background-color: #242428;
    border: 2px solid #27272A;
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
    outline: none;
}

.form-input::placeholder {
    color: #52525B;
}

.form-input:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
    background-color: #242428;
}

.form-input:hover:not(:focus):not(.error) {
    border-color: rgba(99,102,241,0.3);
}

.form-input:disabled {
    background-color: #1C1C1F;
    color: #52525B;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================
   SELECT DROPDOWNS
   ========================================== */
.form-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: #FAFAFA;
    background-color: #242428;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' 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 0.75rem center;
    background-size: 16px;
    border: 2px solid #27272A;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    appearance: none;
}

.form-select:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

.form-select:hover:not(:focus):not(.error) {
    border-color: rgba(99,102,241,0.3);
}

.form-select:disabled {
    background-color: #1C1C1F;
    color: #52525B;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-select option {
    padding: 0.5rem;
    background: #242428;
    color: #FAFAFA;
}

/* ==========================================
   TEXTAREA
   ========================================== */
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: #FAFAFA;
    background-color: #242428;
    border: 2px solid #27272A;
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
    outline: none;
    resize: vertical;
    min-height: 100px;
}

.form-textarea::placeholder {
    color: #52525B;
}

.form-textarea:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

.form-textarea:hover:not(:focus):not(.error) {
    border-color: rgba(99,102,241,0.3);
}

/* ==========================================
   CHECKBOXES & RADIO BUTTONS
   ========================================== */
.form-checkbox,
.form-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #27272A;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #242428;
}

.form-checkbox {
    border-radius: 4px;
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox:checked,
.form-radio:checked {
    background-color: #6366F1;
    border-color: #6366F1;
}

.form-checkbox:focus,
.form-radio:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

/* ==========================================
   ERROR STATES
   ========================================== */
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger);
    background-color: rgba(239,68,68,0.05);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(239,68,68,0.12);
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.375rem;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   SUCCESS STATES
   ========================================== */
.form-input.success,
.form-select.success {
    border-color: var(--success);
    background-color: rgba(16,185,129,0.05);
}

.form-success {
    display: block;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.375rem;
}

/* ==========================================
   HELPER TEXT
   ========================================== */
.form-help {
    display: block;
    color: #71717A;
    font-size: 0.85rem;
    margin-top: 0.375rem;
    line-height: 1.4;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    white-space: nowrap;
    user-select: none;
}

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

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    width: 100%;
}

.btn-xl {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Button Variants */
.btn-primary {
    background: #18181B;
    color: #FAFAFA;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.btn-primary:hover:not(:disabled) {
    background: #27272A;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #242428;
    color: #A1A1AA;
    border-color: #27272A;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #2A2A2E;
    border-color: #3F3F46;
    color: #FAFAFA;
}

.btn-outline {
    background-color: transparent;
    color: #6366F1;
    border-color: rgba(99,102,241,0.3);
}

.btn-outline:hover:not(:disabled) {
    background-color: rgba(99,102,241,0.15);
    border-color: #6366F1;
    color: #FAFAFA;
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239,68,68,0.3);
}

.btn-success {
    background-color: var(--success);
    color: #FAFAFA;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    transform: translateY(-2px);
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #FAFAFA;
    animation: btnSpin 0.6s linear infinite;
}

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

/* ==========================================
   INPUT GROUPS
   ========================================== */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-input {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-group .btn {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #242428;
    border: 2px solid #27272A;
    color: #A1A1AA;
    font-weight: 500;
    white-space: nowrap;
}

.input-group-prepend {
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-append {
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ==========================================
   FORM ROW (Multi-column layout)
   ========================================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ==========================================
   FILE UPLOAD
   ========================================== */
.form-file {
    width: 100%;
}

.form-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #1C1C1F;
    border: 2px dashed #27272A;
    border-radius: var(--radius-md);
    color: #71717A;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.form-file-label:hover {
    background-color: rgba(99,102,241,0.05);
    border-color: rgba(99,102,241,0.3);
    color: #6366F1;
}

.form-file-input {
    display: none;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
