/* Enhanced Form Elements for Kabir-Lesson */

/* ====== Common Input Styles ====== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 1rem;
    background-color: #fff;
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

/* Input Focus Effect */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2);
    transform: translateY(-2px);
}

/* Input Hover Effect */
input:hover,
textarea:hover,
select:hover {
    border-color: rgba(92, 64, 51, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Form Label Enhancement */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

/* Input Placeholders */
::placeholder {
    color: rgba(0, 0, 0, 0.4);
    font-style: italic;
    opacity: 0.7;
    transition: opacity 0.3s;
}

input:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.4;
}

/* ====== Enhanced Textarea ====== */
textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.05) 31px);
    background-size: 100% 32px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    overflow: auto;
    transition: all 0.3s ease, height 0.1s ease;
}

textarea:focus {
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.1) 31px);
}

/* Auto-expanding textarea effect */
.auto-expand {
    overflow: hidden;
    resize: none;
    min-height: 120px;
    transition: height 0.2s ease;
}

/* ====== Enhanced Dropdowns ====== */
select {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c4033' 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 15px center;
    background-size: 16px;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c4033' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Custom select options styling through option container */
.select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* ====== Specific Input Types ====== */

/* Vocab Question Select Enhancement */
.vocab-question select {
    padding: 12px 18px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-size: 1.05rem;
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
    margin: 0 5px;
    min-width: 140px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c4033' 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 10px center;
    background-size: 1em;
    padding-right: 40px;
}

.vocab-question select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2);
    transform: translateY(-2px);
}

.vocab-question select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* Enhanced Reflection Textarea */
.reflection-exercise textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1.05rem;
    resize: vertical;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    min-height: 140px;
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.05) 31px);
    background-size: 100% 32px;
}

.reflection-exercise textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2), 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.1) 31px);
}

/* Enhanced Contraction Input */
.contraction-input {
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    padding: 12px 18px;
    margin: 0 8px;
    min-width: 140px;
    font-size: 1.05rem;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
}

.contraction-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2), 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Enhanced contraction item */
.contraction-item {
    margin: 16px 0;
    padding: 18px;
    background: white;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
}

.contraction-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Enhanced Question Textarea */
.question-textarea {
    width: 100%;
    padding: 18px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1.05rem;
    resize: vertical;
    min-height: 140px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    line-height: 1.6;
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.05) 31px);
    background-size: 100% 32px;
}

.question-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2), 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Enhanced Radio Buttons */
.option {
    display: flex;
    align-items: center;
    margin: 14px 0;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: var(--input-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.option:hover {
    background: #f1f3f5;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(92, 64, 51, 0.1);
}

.option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(92, 64, 51, 0.3);
    border-radius: 50%;
    margin-right: 15px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.option input[type="radio"]::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.2s ease-in-out;
    background-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(92, 64, 51, 0.3);
}

.option input[type="radio"]:checked {
    border-color: var(--primary-color);
    background-color: rgba(92, 64, 51, 0.05);
}

.option input[type="radio"]:checked::before {
    transform: scale(1);
}

/* Selected option styling */
.option input[type="radio"]:checked + label {
    font-weight: 600;
    color: var(--primary-color);
}

.option:has(input[type="radio"]:checked) {
    background-color: rgba(92, 64, 51, 0.05);
    border: 1px solid rgba(92, 64, 51, 0.2);
    box-shadow: var(--shadow-sm);
}

/* Enhanced Writing Pad */
.writing-pad textarea {
    width: 100%;
    padding: 20px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1.05rem;
    resize: vertical;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    line-height: 1.8;
    min-height: 220px;
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.05) 31px);
    background-size: 100% 32px;
}

.writing-pad textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2), 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
}

/* Listening Notes Enhancements */
.listening-notes textarea {
    width: 100%;
    padding: 18px;
    border: 2px solid rgba(92, 64, 51, 0.15);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1.05rem;
    resize: vertical;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    outline: none;
    line-height: 1.6;
    background-image: linear-gradient(transparent, transparent 31px, rgba(92, 64, 51, 0.05) 31px);
    background-size: 100% 32px;
}

.listening-notes textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2), 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.listening-notes h4 {
    margin: 15px 0;
    color: var(--primary-color);
    font-weight: 600;
}

/* Animated focus ring for all inputs */
@keyframes focusRing {
    0% { box-shadow: 0 0 0 0 rgba(92, 64, 51, 0.4); }
    50% { box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2); }
    100% { box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.2); }
}

input:focus,
textarea:focus,
select:focus {
    animation: focusRing 0.3s ease forwards;
}

/* Add subtle input animations */
@keyframes inputFadeIn {
    from { opacity: 0.7; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.exercise-card input,
.exercise-card textarea,
.exercise-card select {
    animation: inputFadeIn 0.5s ease forwards;
}

/* Accessibility - Skip focus animation when using keyboard navigation */
.user-is-tabbing input:focus,
.user-is-tabbing textarea:focus,
.user-is-tabbing select:focus {
    animation: none;
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.3), 0 0 0 6px rgba(92, 64, 51, 0.2);
    outline: 2px solid var(--primary-color);
}
