/* Smart Show - Modal Styles */

/* Modals */
.modal-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px) saturate(120%);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-bg.show {
    display: flex;
}

.modal {
    background: #ffffff;
    color: #333333;
    border: none;
    border-radius: 22px;
    box-shadow: 0 8px 40px 0 rgba(0, 0, 0, 0.15), 0 1.5px 8px 0 rgba(0, 0, 0, 0.1);
    padding: 2.5rem 2.2rem 2rem 2.2rem;
    max-width: 420px;
    min-width: 320px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 0 0 1.5rem 0;
    border-bottom: 1.5px solid #e0e0e0;
    margin-bottom: 1.5rem;
    background: none;
}

.modal-header h3 {
    color: #7c9885;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin: 0 auto;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.3em;
    color: #7c9885;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e9ecef;
    color: #5a6b5d;
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
}

.modal-content {
    padding-bottom: 0.25rem;
    color: #333333;
    margin: 0.5rem 0;
    max-height: 60vh;
    padding: 0.75rem;
    margin: 0.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    color: #5a6b5d;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 1.08em;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1.5px solid #d0d0d0;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 0.1rem;
    background: #ffffff;
    color: #333333;
    transition: border 0.2s, box-shadow 0.2s;
    box-shadow: 0 1.5px 6px 0 rgba(0, 0, 0, 0.04);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #7c9885;
    outline: none;
    box-shadow: 0 0 0 2px rgba(124, 152, 133, 0.13);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.btn {
    padding: 0.6rem 1.8rem;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1.5px 6px 0 rgba(0, 0, 0, 0.04);
}

.btn.primary {
    background: #7c9885;
    color: #ffffff;
}

.btn.primary:hover {
    background: #9cb4a8;
    color: #ffffff;
}

.btn.secondary {
    background: #f8f9fa;
    color: #5a6b5d;
    border: 1px solid #d0d0d0;
}

.btn.secondary:hover {
    background: #e9ecef;
    color: #5a6b5d;
}

/* AI Modal Styles */
.ai-modal {
    max-width: 600px;
    min-width: 320px;
    width: 90vw;
    height: 70vh;
    max-height: 600px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0; /* Important for flex child */
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--sage-lighter);
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 200px;
    max-height: calc(100vh - 300px);
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    background: #7c9885;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ai-message.user .ai-avatar {
    background: #9cb4a8;
}

.message-content {
    background: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
}

.ai-message.user .message-content {
    background: #7c9885;
    color: #ffffff;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.95rem;
}

.ai-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #ffffff;
    border: 1.5px solid #d0d0d0;
    border-radius: 12px;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
}

.ai-input-container input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem;
    font-size: 0.95rem;
    background: transparent;
}

.ai-input-container input:focus {
    outline: none;
}

.ai-input-container button {
    background: #7c9885;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-input-container button:hover {
    background: #9cb4a8;
    transform: scale(1.05);
}

.ai-input-container button:active {
    transform: scale(0.95);
}

#aiVoiceBtn {
    background: #9cb4a8;
}

#aiVoiceBtn:hover {
    background: #7c9885;
}

#aiVoiceBtn.recording {
    background: #ff6b6b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #7c9885;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Admin Login Card Styles */
.admin-login-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.admin-login-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7c9885, #9cb4a8);
}

.admin-login-card form {
    position: relative;
    z-index: 1;
}

.admin-login-card .form-group label {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 1.08em;
    letter-spacing: 0.01em;
}

.admin-login-card .form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border 0.2s, box-shadow 0.2s;
}

.admin-login-card .form-group input:focus {
    outline: none;
    border-color: var(--sage-primary);
    box-shadow: 0 0 0 3px rgba(124, 152, 133, 0.1);
}

.admin-login-card .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border 0.2s, box-shadow 0.2s;
    appearance: none;
    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='%237c9885' 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 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.admin-login-card .form-group select:focus {
    outline: none;
    border-color: var(--sage-primary);
    box-shadow: 0 0 0 3px rgba(124, 152, 133, 0.1);
}

.admin-login-card .form-group select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.admin-login-card .form-group select option:first-child {
    color: var(--text-secondary);
    font-style: italic;
}

.admin-login-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #7c9885, #9cb4a8);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px 0 rgba(124, 152, 133, 0.3);
}

#adminLoginForm .admin-login-btn {
    width: 100%;
}

.admin-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px 0 rgba(124, 152, 133, 0.4);
}

/* Admin Login Responsive Styles */
@media (max-width: 768px) {
    .admin-login-card {
        max-width: 100%;
        margin: 0 1rem;
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .admin-login-card .form-group label {
        font-size: 1em;
    }
    
    .admin-login-card .form-group input {
        padding: 0.75rem 0.875rem;
        font-size: 0.95em;
    }
    
    .admin-login-card .form-group select {
        padding: 0.75rem 0.875rem;
        font-size: 0.95em;
        padding-right: 2.5rem;
    }
    
    .admin-login-btn {
        padding: 0.75rem 1.25rem;
        font-size: 1em;
    }
    
    /* OTP Section Responsive */
    .otp-section {
        margin-top: 0.875rem;
        padding-top: 0.875rem;
    }
    
    .otp-option {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .otp-divider {
        margin: 0.75rem 0;
    }
    
    .otp-divider span {
        padding: 0.25rem 0.75rem;
        font-size: 0.85em;
    }
    
    .otp-toggle-text {
        font-size: 0.9em;
        padding: 0.5rem 0.75rem;
    }
    
    .otp-toggle-text i {
        font-size: 1em;
    }
    
    .otp-input-section input {
        font-size: 1.1rem;
        letter-spacing: 0.4rem;
        padding: 0.75rem 0.5rem;
    }
    
    .otp-timer {
        font-size: 0.85rem;
        margin-top: 0.375rem;
    }
    

}

@media (max-width: 600px) {
    .admin-login-card {
        padding: 1.25rem;
        margin: 0 0.75rem;
        border-radius: 10px;
    }
    
    .admin-login-card .form-group {
        margin-bottom: 1.25rem;
    }
    
    .admin-login-card .form-group label {
        font-size: 0.95em;
        margin-bottom: 0.375rem;
    }
    
    .admin-login-card .form-group input {
        padding: 0.7rem 0.75rem;
        font-size: 0.9em;
        border-radius: 6px;
    }
    
    .admin-login-card .form-group select {
        padding: 0.7rem 0.75rem;
        font-size: 0.9em;
        border-radius: 6px;
        padding-right: 2.5rem;
    }
    
    .admin-login-btn {
        padding: 0.7rem 1rem;
        font-size: 0.95em;
        border-radius: 6px;
    }
    
    /* OTP Section Responsive */
    .otp-section {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }
    
    .otp-option {
        margin-top: 0.875rem;
        padding-top: 0.875rem;
    }
    
    .otp-divider {
        margin: 0.625rem 0;
    }
    
    .otp-divider span {
        padding: 0.2rem 0.625rem;
        font-size: 0.8em;
    }
    
    .otp-toggle-text {
        font-size: 0.85em;
        padding: 0.4rem 0.625rem;
    }
    
    .otp-toggle-text i {
        font-size: 0.95em;
    }
    
    .otp-input-section input {
        font-size: 1rem;
        letter-spacing: 0.3rem;
        padding: 0.625rem 0.375rem;
    }
    
    .otp-timer {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }
    

}

@media (max-width: 480px) {
    .admin-login-card {
        padding: 1rem;
        margin: 0 0.5rem;
        border-radius: 8px;
        box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
    }
    
    .admin-login-card .form-group {
        margin-bottom: 1rem;
    }
    
    .admin-login-card .form-group label {
        font-size: 0.9em;
        margin-bottom: 0.25rem;
    }
    
    .admin-login-card .form-group input {
        padding: 0.625rem 0.625rem;
        font-size: 0.85em;
        border-radius: 4px;
    }
    
    .admin-login-card .form-group select {
        padding: 0.625rem 0.625rem;
        font-size: 0.85em;
        border-radius: 4px;
        padding-right: 2.5rem;
    }
    
    .admin-login-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.9em;
        border-radius: 4px;
        box-shadow: 0 2px 8px 0 rgba(124, 152, 133, 0.25);
    }
    
    .admin-login-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 12px 0 rgba(124, 152, 133, 0.3);
    }
    
    /* OTP Section Responsive */
    .otp-section {
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }
    
    .otp-option {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }
    
    .otp-divider {
        margin: 0.5rem 0;
    }
    
    .otp-divider span {
        padding: 0.15rem 0.5rem;
        font-size: 0.75em;
    }
    
    .otp-toggle-text {
        font-size: 0.8em;
        padding: 0.3rem 0.5rem;
    }
    
    .otp-toggle-text i {
        font-size: 0.9em;
    }
    
    .otp-input-section input {
        font-size: 0.9rem;
        letter-spacing: 0.25rem;
        padding: 0.5rem 0.25rem;
    }
    
    .otp-timer {
        font-size: 0.75rem;
        margin-top: 0.2rem;
    }
    

}

@media (max-width: 360px) {
    .admin-login-card {
        padding: 0.875rem;
        margin: 0 0.25rem;
        border-radius: 6px;
    }
    
    .admin-login-card .form-group {
        margin-bottom: 0.875rem;
    }
    
    .admin-login-card .form-group label {
        font-size: 0.85em;
        margin-bottom: 0.25rem;
    }
    
    .admin-login-card .form-group input {
        padding: 0.5rem 0.5rem;
        font-size: 0.8em;
        border-radius: 3px;
    }
    
    .admin-login-card .form-group select {
        padding: 0.5rem 0.5rem;
        font-size: 0.8em;
        border-radius: 3px;
        padding-right: 2.5rem;
    }
    
    .admin-login-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85em;
        border-radius: 3px;
    }
    
    /* OTP Section Responsive */
    .otp-section {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .otp-option {
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }
    
    .otp-divider {
        margin: 0.375rem 0;
    }
    
    .otp-divider span {
        padding: 0.1rem 0.375rem;
        font-size: 0.7em;
    }
    
    .otp-toggle-text {
        font-size: 0.75em;
        padding: 0.25rem 0.375rem;
    }
    
    .otp-toggle-text i {
        font-size: 0.85em;
    }
    
    .otp-input-section input {
        font-size: 0.8rem;
        letter-spacing: 0.2rem;
        padding: 0.375rem 0.125rem;
    }
    
    .otp-timer {
        font-size: 0.7rem;
        margin-top: 0.15rem;
    }
    

}

/* Landscape orientation adjustments for admin login */
@media (max-height: 500px) and (orientation: landscape) {
    .admin-login-card {
        padding: 1rem;
        margin: 0.5rem auto;
    }
    
    .admin-login-card .form-group {
        margin-bottom: 0.75rem;
    }
    
    .admin-login-card .form-group label {
        font-size: 0.9em;
        margin-bottom: 0.25rem;
    }
    
    .admin-login-card .form-group input {
        padding: 0.5rem 0.75rem;
        font-size: 0.85em;
    }
    
    .admin-login-card .form-group select {
        padding: 0.5rem 0.75rem;
        font-size: 0.85em;
        padding-right: 2.5rem;
    }
    
    .admin-login-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9em;
    }
    
    /* OTP Section Landscape */
    .otp-section {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .otp-option {
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }
    
    .otp-divider {
        margin: 0.375rem 0;
    }
    
    .otp-divider span {
        padding: 0.1rem 0.5rem;
        font-size: 0.8em;
    }
    
    .otp-toggle-text {
        font-size: 0.85em;
        padding: 0.25rem 0.5rem;
    }
    
    .otp-input-section input {
        font-size: 0.9rem;
        letter-spacing: 0.3rem;
        padding: 0.5rem 0.25rem;
    }
    
    .otp-timer {
        font-size: 0.8rem;
        margin-top: 0.2rem;
    }
    

}

/* Touch device optimizations for admin login */
@media (hover: none) and (pointer: coarse) {
    .admin-login-card .form-group input {
        min-height: 44px; /* iOS minimum touch target */
    }
    
    .admin-login-card .form-group select {
        min-height: 44px; /* iOS minimum touch target */
    }
    
    .admin-login-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .admin-login-btn:hover {
        transform: none;
    }
    
    .admin-login-btn:active {
        transform: translateY(1px);
        box-shadow: 0 2px 4px 0 rgba(124, 152, 133, 0.2);
    }
    
    /* OTP Toggle Touch Optimizations */
    .otp-toggle-label {
        min-height: 44px;
        min-width: 44px;
    }
    
    .otp-toggle-label:hover {
        background: var(--gray-100);
    }
    
    .otp-toggle-label:active {
        background: var(--gray-200);
    }
    
    /* OTP Input Touch Optimizations */
    .otp-input-section input {
        min-height: 44px;
        font-size: 1.1rem;
        letter-spacing: 0.5rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .admin-login-card {
        border-width: 0.5px;
    }
    
    .admin-login-card .form-group input {
        border-width: 0.5px;
    }
    
    .admin-login-card .form-group select {
        border-width: 0.5px;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .admin-login-card,
    .admin-login-card .form-group input,
    .admin-login-btn {
        transition: none;
    }
    
    .admin-login-card .form-group select {
        transition: none;
    }
    
    .admin-login-btn:hover {
        transform: none;
    }
}

.admin-login-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}



/* Settings Modal (White Label) Styles */
.white-label-modal {
    max-width: 800px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.white-label-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--gray-300);
    padding-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.white-label-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.tab-btn:hover {
    background: var(--gray-100);
    color: var(--sage-primary);
}

.tab-btn.active {
    background: var(--sage-primary);
    color: var(--white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.logo-upload {
    position: relative;
}

.logo-preview {
    width: 100%;
    height: 100px;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo-preview:hover {
    border-color: var(--sage-primary);
    color: var(--sage-primary);
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.color-scheme {
    margin-bottom: 2rem;
}

.color-scheme h4 {
    margin-bottom: 1rem;
    color: var(--sage-dark);
    font-weight: 600;
}

.color-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.color-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-input label {
    font-weight: 500;
    color: var(--sage-dark);
}

.color-input input[type="color"] {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.theme-option {
    cursor: pointer;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.theme-option input[type="radio"]:checked + .theme-preview {
    border-color: var(--sage-primary);
    background: var(--sage-lighter);
}

.theme-sample {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
}

.light-theme .theme-sample {
    background: var(--white);
    border-color: var(--gray-300);
}

.dark-theme .theme-sample {
    background: var(--gray-800);
    border-color: var(--gray-600);
}

.auto-theme .theme-sample {
    background: linear-gradient(45deg, var(--white) 50%, var(--gray-800) 50%);
    border-color: var(--gray-400);
}

/* Small OTP Option at Bottom */
.otp-option {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.otp-divider {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
}

.otp-divider span {
    background: var(--bg-primary);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.otp-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: -1;
}

.otp-toggle {
    text-align: center;
    margin-bottom: 1rem;
}

.otp-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.otp-toggle-label input[type="checkbox"] {
    display: none;
}

.otp-toggle-label input[type="checkbox"]:checked + .otp-toggle-text {
    color: var(--sage-primary);
}

.otp-toggle-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.otp-toggle-text i {
    font-size: 1.1em;
}

.otp-section {
    margin-top: 1rem;
    padding-top: 1rem;
}

.otp-btn {
    background: var(--sage-primary);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.otp-input-section {
    margin-top: 1rem;
}

.otp-input-section input {
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 0.5rem;
    font-weight: 600;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    transition: border 0.2s, box-shadow 0.2s;
}

.otp-input-section input:focus {
    outline: none;
    border-color: var(--sage-primary);
    box-shadow: 0 0 0 3px rgba(124, 152, 133, 0.1);
}

.otp-timer {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.otp-timer span {
    font-weight: 600;
    color: var(--sage-primary);
}

/* OTP hover effects for better dark theme compatibility */
.otp-toggle-label:hover {
    background: var(--bg-tertiary);
    border-color: var(--sage-primary);
}

/* Responsive Styles for Settings Modal */
@media (max-width: 1200px) {
    .ai-modal {
        width: 85vw;
        max-width: 550px;
    }
    
    .ai-messages {
        max-height: calc(100vh - 280px);
    }
}

@media (max-width: 900px) {
    .ai-modal { 
        width: 90vw;
        max-width: 500px;
        height: 75vh;
        max-height: 550px;
    }
    
    .ai-messages {
        max-height: calc(100vh - 260px);
        min-height: 180px;
    }
    
    .ai-input-container {
        gap: 0.4rem;
        padding: 0.4rem;
    }
    
    .ai-input-container input {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .ai-input-container button {
        width: 36px;
        height: 36px;
    }
    
    .message-content {
        max-width: 85%;
        padding: 0.6rem 0.8rem;
    }
    
    .ai-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .modal {
        padding: 1.5rem 1.2rem 1rem 1.2rem;
        max-width: 95vw;
        min-width: 280px;
        border-radius: 16px;
    }
    
    .ai-modal {
        width: 95vw;
        max-width: none;
        height: 80vh;
        max-height: 500px;
        min-height: 350px;
        border-radius: 16px;
        padding: 1.5rem 1.2rem 1rem 1.2rem;
    }
    
    .ai-messages {
        max-height: calc(100vh - 240px);
        min-height: 160px;
        padding: 0.8rem;
    }
    
    .ai-input-container {
        gap: 0.3rem;
        padding: 0.3rem;
        border-radius: 10px;
    }
    
    .ai-input-container input {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }
    
    .ai-input-container button {
        width: 32px;
        height: 32px;
    }
    
    .message-content {
        max-width: 90%;
        padding: 0.5rem 0.7rem;
        border-radius: 10px;
    }
    
    .ai-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .ai-message {
        gap: 0.5rem;
        margin-bottom: 0.8rem;
    }
    
    /* Settings Modal Responsive */
    .white-label-modal {
        width: 95vw;
        max-width: none;
        max-height: 85vh;
        padding: 1.5rem 1.2rem 1rem 1.2rem;
        border-radius: 16px;
    }
    
    .white-label-tabs {
        gap: 0.3rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.8rem;
    }
    
    .tab-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        border-radius: 6px;
    }
    
    .color-inputs {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .theme-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .theme-preview {
        padding: 0.8rem;
        border-radius: 10px;
    }
    
    .theme-sample {
        width: 50px;
        height: 35px;
    }
    
    .logo-preview {
        height: 70px;
    }
}

@media (max-width: 600px) {
    .modal {
        padding: 1.2rem 1rem 0.8rem 1rem;
        max-width: 98vw;
        min-width: 260px;
        border-radius: 12px;
    }
    
    .ai-modal {
        width: 98vw;
        height: 85vh;
        max-height: 450px;
        min-height: 300px;
        border-radius: 12px;
        padding: 1.2rem 1rem 0.8rem 1rem;
    }
    
    .ai-messages {
        max-height: calc(100vh - 220px);
        min-height: 140px;
        padding: 0.6rem;
    }
    
    .ai-input-container {
        gap: 0.25rem;
        padding: 0.25rem;
        border-radius: 8px;
    }
    
    .ai-input-container input {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .ai-input-container button {
        width: 28px;
        height: 28px;
    }
    
    .message-content {
        max-width: 92%;
        padding: 0.4rem 0.6rem;
        border-radius: 8px;
    }
    
    .ai-avatar {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .ai-message {
        gap: 0.4rem;
        margin-bottom: 0.6rem;
    }
    
    .modal-header h3 {
        font-size: 1.3rem;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.2em;
        top: 12px;
        right: 12px;
    }
    
    /* Settings Modal Mobile */
    .white-label-modal {
        width: 98vw;
        max-height: 90vh;
        padding: 1.2rem 1rem 0.8rem 1rem;
        border-radius: 12px;
    }
    
    .white-label-tabs {
        gap: 0.2rem;
        margin-bottom: 1.2rem;
        padding-bottom: 0.6rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 6px;
        min-width: 80px;
    }
    
    .color-inputs {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .color-input input[type="color"] {
        height: 45px;
    }
    
    .theme-options {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .theme-preview {
        padding: 0.6rem;
        border-radius: 8px;
    }
    
    .theme-sample {
        width: 45px;
        height: 30px;
    }
    
    .logo-preview {
        height: 60px;
    }
    
    .form-group {
        margin-bottom: 0.8rem;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .modal-actions {
        gap: 0.8rem;
        margin-top: 1.2rem;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .ai-modal {
        padding: 0.8rem;
    }
    
    .ai-messages {
        max-height: calc(100vh - 260px);
        padding: 0.4rem;
    }
    
    .ai-input-container {
        gap: 0.25rem;
        padding: 0.2rem;
        border-radius: 0.8rem;
    }
    
    .ai-input-container input {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .ai-input-container button {
        width: 28px;
        height: 28px;
    }
    
    .message-content {
        max-width: 90%;
        padding: 0.35rem 0.5rem;
        border-radius: 6px;
    }
    
    .ai-avatar {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .ai-message {
        gap: 0.3rem;
        margin-bottom: 0.5rem;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1em;
        top: 8px;
        right: 8px;
    }
    
    /* Settings Modal Small Mobile */
    .white-label-modal {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        padding: 1rem 0.8rem 0.6rem 0.8rem;
        max-height: 95vh;
    }
    
    .white-label-tabs {
        gap: 0.15rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 4px;
        min-width: 70px;
    }
    
    .color-inputs {
        gap: 0.5rem;
    }
    
    .color-input input[type="color"] {
        height: 40px;
    }
    
    .theme-options {
        gap: 0.5rem;
    }
    
    .theme-preview {
        padding: 0.5rem;
        border-radius: 6px;
    }
    
    .theme-sample {
        width: 40px;
        height: 25px;
    }
    
    .logo-preview {
        height: 55px;
    }
    
    .form-group {
        margin-bottom: 0.6rem;
    }
    
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
    }
    
    .modal-actions {
        gap: 0.6rem;
        margin-top: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .ai-modal {
        padding: 0.6rem;
    }
    
    .ai-messages {
        max-height: calc(100vh - 240px);
        padding: 0.3rem;
    }
    
    .ai-input-container {
        gap: 0.2rem;
        padding: 0.15rem;
        border-radius: 0.6rem;
    }
    
    .ai-input-container input {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .ai-input-container button {
        width: 24px;
        height: 24px;
    }
    
    .message-content {
        max-width: 95%;
        padding: 0.3rem 0.4rem;
        border-radius: 4px;
    }
    
    .ai-avatar {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    
    .ai-message {
        gap: 0.25rem;
        margin-bottom: 0.4rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-close {
        width: 24px;
        height: 24px;
        font-size: 0.9em;
        top: 6px;
        right: 6px;
    }
    
    /* Settings Modal Extra Small */
    .white-label-modal {
        padding: 0.8rem 0.6rem 0.4rem 0.6rem;
        max-height: 98vh;
    }
    
    .white-label-tabs {
        gap: 0.1rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.4rem;
    }
    
    .tab-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        border-radius: 3px;
        min-width: 60px;
    }
    
    .color-inputs {
        gap: 0.4rem;
    }
    
    .color-input input[type="color"] {
        height: 35px;
    }
    
    .theme-options {
        gap: 0.4rem;
    }
    
    .theme-preview {
        padding: 0.4rem;
        border-radius: 4px;
    }
    
    .theme-sample {
        width: 35px;
        height: 20px;
    }
    
    .logo-preview {
        height: 50px;
    }
    
    .form-group {
        margin-bottom: 0.5rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .modal-actions {
        gap: 0.5rem;
        margin-top: 0.8rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .ai-modal {
        height: 95vh;
        max-height: 95vh;
    }
    
    .ai-messages {
        max-height: calc(95vh - 180px);
        min-height: 150px;
    }
    
    .ai-input-container {
        padding: 0.2rem;
    }
    
    .ai-input-container input {
        padding: 0.3rem 0.5rem;
    }
    
    .ai-input-container button {
        width: 28px;
        height: 28px;
    }
    
    /* Settings Modal Landscape */
    .white-label-modal {
        max-height: 95vh;
        padding: 1rem 1.5rem 0.8rem 1.5rem;
    }
    
    .white-label-tabs {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    .color-inputs {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .theme-options {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ai-modal {
        border-width: 0.5px;
    }
    
    .ai-input-container {
        border-width: 0.5px;
    }
    
    .message-content {
        border-width: 0.5px;
    }
    
    .white-label-modal {
        border-width: 0.5px;
    }
    
    .tab-btn {
        border-width: 0.5px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .ai-input-container button {
        min-width: 44px;
        min-height: 44px;
    }
    
    .ai-input-container button:hover {
        transform: none;
    }
    
    .ai-input-container button:active {
        transform: scale(0.95);
    }
    
    .modal-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Settings Modal Touch */
    .tab-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tab-btn:active {
        background: var(--sage-primary);
        color: var(--white);
        transform: scale(0.98);
    }
    
    .theme-option {
        min-height: 44px;
    }
    
    .theme-option:hover .theme-preview {
        border-color: var(--gray-300);
    }
    
    .theme-option:active .theme-preview {
        border-color: var(--sage-primary);
        background: var(--sage-lighter);
        transform: scale(0.98);
    }
    
    .color-input input[type="color"] {
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
    }
}

/* Modal background responsive adjustments */
@media (max-width: 600px) {
    .modal-bg {
        padding: 0;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Safe area support for devices with notches */
@supports (padding: max(0px)) {
    .ai-modal {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .white-label-modal {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Focus management for accessibility */
.ai-modal:focus {
    outline: none;
}

.ai-input-container input:focus {
    outline: none;
    border-color: var(--sage-primary);
    box-shadow: 0 0 0 2px rgba(124, 152, 133, 0.2);
}

/* Custom scrollbar for webkit browsers */
.ai-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.ai-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ai-modal,
    .ai-input-container button,
    .modal-close,
    .tab-btn,
    .theme-preview,
    .logo-preview {
        transition: none;
    }
    
    .ai-input-container button:hover,
    .ai-input-container button:active,
    .tab-btn:hover,
    .tab-btn:active,
    .theme-option:active .theme-preview {
        transform: none;
    }
}

/* Focus visible for keyboard navigation */
.ai-input-container button:focus-visible,
.modal-close:focus-visible,
.tab-btn:focus-visible,
.theme-option:focus-visible .theme-preview,
.logo-preview:focus-visible {
    outline: 2px solid var(--sage-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .ai-modal {
        display: none;
    }
    
    .white-label-modal {
        display: none;
    }
}

/* Responsive styles for modal actions */
@media (max-width: 768px) {
    .modal-actions {
        gap: 0.8rem;
        margin-top: 1.2rem;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        min-width: 120px;
    }
}

@media (max-width: 600px) {
    .modal-actions {
        gap: 0.8rem;
        margin-top: 1.2rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .modal-actions {
        gap: 0.6rem;
        margin-top: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        min-height: 44px;
    }
}

@media (max-width: 360px) {
    .modal-actions {
        gap: 0.5rem;
        margin-top: 0.8rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
}

/* Touch device optimizations for buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn:hover {
        background: inherit;
        color: inherit;
        box-shadow: inherit;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn.primary:active {
        background: #9cb4a8;
    }
    
    .btn.secondary:active {
        background: #e9ecef;
    }
}

/* Focus management for buttons */
.btn:focus-visible {
    outline: 2px solid var(--sage-primary);
    outline-offset: 2px;
}

/* Reduced motion support for buttons */
@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
    
    .btn:hover,
    .btn:active {
        transform: none;
    }
} 