/* ===================================
   SHARED COMPONENTS CSS
   Consolidates repeated patterns
   =================================== */

/* Audio Record Button - Used 14+ times */
.audio-record-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #FF8C00;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.audio-record-btn:hover {
    background: rgba(255, 140, 0, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.audio-record-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.audio-record-btn.recording {
    color: #F44336;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* For textarea, position at top */
.form-group textarea ~ .audio-record-btn {
    top: 12px;
    transform: none;
}

.form-group textarea ~ .audio-record-btn:hover {
    transform: scale(1.1);
}

/* Input with Audio Wrapper - Used 13+ times */
.input-with-audio {
    position: relative;
    width: 100%;
}

.input-with-audio .form-input {
    padding-right: 48px; /* Space for audio button */
}

/* Google Auth Button - Used 2 times */
.btn-google {
    width: 100%;
    padding: 12px 24px;
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-google:hover {
    background: var(--bg-light);
    border-color: #FF8C00;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-google .google-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Modal Close Button - Used 3+ times */
.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
    transform: rotate(90deg);
}

/* Back Button - Used multiple times */
.back-btn {
    background: none;
    border: none;
    color: var(--primary-purple);
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
    padding: 8px 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    color: #FF8C00;
    transform: translateX(-4px);
}

/* Option Card - Used in typing options */
.option-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

.option-card:hover {
    border-color: #FF8C00;
    background: rgba(255, 140, 0, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.option-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 140, 0, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
}

.option-card-content {
    flex: 1;
}

.option-card-title {
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.option-card-desc {
    color: var(--text-gray);
    font-size: 13px;
    margin: 0;
}

.option-card-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #FF8C00;
}

/* Error Message - Standardized */
.error-message {
    display: none;
    color: #F44336;
    font-size: 12px;
    margin-top: 4px;
}

.error-message.visible {
    display: block;
}

/* Form Group - Standardized spacing */
.form-group {
    margin-bottom: 20px;
}

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

/* Divider - Used in modals */
.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
    color: var(--text-gray);
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 60px);
    height: 1px;
    background: var(--border-color);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Loading Spinner - For async operations */
.spinner {
    border: 2px solid rgba(255, 140, 0, 0.2);
    border-top: 2px solid #FF8C00;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Helper classes */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid var(--primary-purple);
    position: relative;
}

.toast.toast-success {
    border-left-color: #4CAF50;
}

.toast.toast-error {
    border-left-color: #F44336;
}

.toast.toast-warning {
    border-left-color: #FF9800;
}

.toast.toast-info {
    border-left-color: #2196F3;
}

.toast.toast-hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 50%;
    padding: 4px;
}

.toast-success .toast-icon {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.toast-error .toast-icon {
    background: rgba(244, 67, 54, 0.1);
    color: #F44336;
}

.toast-warning .toast-icon {
    background: rgba(255, 152, 0, 0.1);
    color: #FF9800;
}

.toast-info .toast-icon {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    margin: 0;
}

.toast-message {
    font-size: 14px;
    color: var(--text-gray);
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .option-card {
        padding: 16px;
    }

    .option-card-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .option-card-title {
        font-size: 14px;
    }

    .option-card-desc {
        font-size: 12px;
    }
}
