/**
 * Chat Widget Styles
 * Frontend chat component for school pages
 */

/* Screen reader only - for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sk-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.sk-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.sk-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: sk-badge-pulse 2s infinite;
}

@keyframes sk-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.sk-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.sk-chat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
}

.sk-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 370px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    animation: sk-chat-slide-up 0.3s ease;
}

@keyframes sk-chat-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.sk-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sk-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sk-chat-school-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.sk-chat-school-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}

.sk-chat-school-name {
    font-weight: 600;
    font-size: 15px;
}

.sk-chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sk-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: sk-pulse 2s infinite;
}

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

.sk-chat-minimize {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sk-chat-minimize:hover {
    background: rgba(255,255,255,0.3);
}

.sk-chat-start {
    padding: 20px;
}

.sk-chat-welcome {
    text-align: center;
    margin-bottom: 20px;
}

.sk-chat-welcome h4 {
    margin: 0 0 8px;
    font-size: 20px;
}

.sk-chat-welcome p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.sk-chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sk-chat-field input,
.sk-chat-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.sk-chat-field input:focus,
.sk-chat-field textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sk-chat-field textarea {
    resize: none;
}

.sk-chat-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sk-chat-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sk-chat-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sk-chat-messages-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.sk-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sk-chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    animation: sk-msg-appear 0.2s ease;
}

@keyframes sk-msg-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sk-chat-message.visitor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.sk-chat-message.school {
    background: #f3f4f6;
    color: #1f2937;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.sk-chat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.sk-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.sk-chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}

.sk-chat-input-area input:focus {
    border-color: #667eea;
}

.sk-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.sk-chat-send-btn:hover {
    transform: scale(1.1);
}

.sk-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 16px;
    width: fit-content;
}

.sk-chat-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: sk-typing 1.4s infinite;
}

.sk-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.sk-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sk-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Typing indicator */
.sk-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-right: auto;
    animation: sk-msg-appear 0.2s ease;
}

.sk-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: sk-typing-bounce 1.4s infinite;
}

.sk-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.sk-typing-dot:nth-child(3) { animation-delay: 0.4s; }

.sk-typing-text {
    font-size: 12px;
    color: #6b7280;
    margin-left: 6px;
}

@keyframes sk-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .sk-chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .sk-chat-window {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 70px;
    }

    .sk-chat-toggle {
        width: 54px;
        height: 54px;
    }
}

/* RTL Support */
[dir="rtl"] .sk-chat-widget {
    right: auto;
    left: 24px;
}

[dir="rtl"] .sk-chat-window {
    right: auto;
    left: 0;
}

[dir="rtl"] .sk-chat-message.visitor {
    margin-left: 0;
    margin-right: auto;
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .sk-chat-message.school {
    margin-right: 0;
    margin-left: auto;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}
