// AI Event Generator Component Styles
// =====================================

// Variables
$ai-primary-gradient: linear-gradient(135deg, $info 0%, $success 100%);
$ai-danger-color: $danger;
$ai-warning-color: $warning;
$ai-success-color: $success;
$ai-border-radius: 12px;
$ai-border-radius-lg: 20px;
$ai-transition: all 0.3s ease;

// AI Trigger Button
.ai-trigger-btn {
    background: $ai-primary-gradient;
    border: none;
    border-radius: $ai-border-radius;
    padding: 12px 20px;
    color: $white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: $ai-transition;
    box-shadow: 0 4px 15px rgba($info, 0.3);
    position: relative;
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s;
    }

    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba($primary, 0.4);

        &::before {
            left: 100%;
        }
    }

    &:active {
        transform: translateY(0);
    }
}

.ai-btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    color: $white;
}

.ai-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.ai-btn-text {
    font-weight: 600;
    letter-spacing: 0.5px;
    color: $white;
}

// Modal Overlay
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: aiFadeIn 0.3s ease;
}

.ai-modal-container {
    background: var(--bg-color);
    border-radius: $ai-border-radius-lg;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: aiSlideUp 0.3s ease;
    border: 1px solid #e5e7eb;
}

// Modal Header
.ai-modal-header {
    background: $ai-primary-gradient;
    color: var(--white);
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
        opacity: 0.3;
    }
}

.ai-modal-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
    color: $white;
}

.ai-title-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-title-content h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-modal-subtitle {
    margin: 4px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
    font-weight: 400;
}

.ai-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: $white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: $ai-transition;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;

    &:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }
}

// Modal Body
.ai-modal-body {
    padding: 32px;
    background: var(--bg-color);
}

.ai-content-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ai-input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 16px;
}

.ai-label-icon {
    color: $ai-warning-color;
    animation: aiPulse 2s infinite;
}

.ai-textarea-wrapper {
    position: relative;
}

.ai-textarea {
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: $ai-border-radius;
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: $ai-transition;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-color);

    &:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
    }

    &::placeholder {
        color: var(--text-muted);
    }
}

.ai-textarea-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.ai-char-count {
    font-size: 12px;
    color: var(--text-muted);
}

.ai-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-voice-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-voice-btn {
    background: var(--bg-secondary);
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: $ai-transition;

    &:hover:not(:disabled) {
        background: var(--bg-hover);
        border-color: #d1d5db;
    }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    &.ai-voice-active {
        background: $ai-danger-color;
        border-color: $ai-danger-color;
        color: var(--white);
        animation: aiPulse 1s infinite;

        &:hover {
            background: darken($ai-danger-color, 10%);
            border-color: darken($ai-danger-color, 10%);
        }
    }
}

.ai-voice-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: $ai-danger-color;
    font-weight: 500;
}

.ai-timer-dot {
    width: 8px;
    height: 8px;
    background: $ai-danger-color;
    border-radius: 50%;
    animation: aiPulse 1s infinite;
}

.ai-clear-btn {
    background: var(--bg-secondary);
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: $ai-transition;

    &:hover:not(:disabled) {
        background: var(--bg-hover);
        color: var(--text-color);
    }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.ai-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    color: $ai-warning-color;
    font-size: 14px;
    padding: 12px;
    background: rgba($ai-warning-color, 0.1);
    border-radius: 8px;
    border: 1px solid rgba($ai-warning-color, 0.2);
}

// Generate Section
.ai-generate-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-generate-btn {
    background: $ai-primary-gradient;
    border: none;
    border-radius: $ai-border-radius;
    padding: 16px 24px;
    color: var(--white);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: $ai-transition;
    box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
    position: relative;
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s;
    }

    &:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(var(--primary-color-rgb), 0.4);

        &::before {
            left: 100%;
        }
    }

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }

    &:active:not(:disabled) {
        transform: translateY(0);
    }
}

.ai-generate-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    color: $white;  
}

.ai-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--white);
    border-radius: 50%;
    animation: aiSpin 1s linear infinite;
}

.ai-generate-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
    line-height: 1.4;
}

// Animations
@keyframes aiFadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

@keyframes aiSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

// Responsive Design
@media (max-width: 768px) {
    .ai-modal-container {
        width: 95%;
        margin: 20px;
    }
    
    .ai-modal-header {
        padding: 20px 24px;
    }
    
    .ai-modal-body {
        padding: 24px;
    }
    
    .ai-title-content h3 {
        font-size: 20px;
    }

    .ai-modal-subtitle {
        font-size: 13px;
    }
}

// Dark theme specific adjustments
[data-theme="dark"] {
    .ai-modal-container {
        border-color: #374151;
    }

    .ai-textarea {
        border-color: #374151;
        background: #1f2937;
        color: #f9fafb;

        &::placeholder {
            color: #9ca3af;
        }
    }

    .ai-voice-btn,
    .ai-clear-btn {
        border-color: #374151;
        background: #374151;
        color: #f9fafb;

        &:hover:not(:disabled) {
            background: #4b5563;
            border-color: #4b5563;
        }
    }

    .ai-warning {
        background: rgba($ai-warning-color, 0.15);
        border-color: rgba($ai-warning-color, 0.3);
    }
}

// Light theme specific adjustments
[data-theme="light"] {
    .ai-modal-container {
        border-color: #e5e7eb;
    }

    .ai-textarea {
        border-color: #e5e7eb;
        background: #ffffff;
        color: #1f2937;

        &::placeholder {
            color: #6b7280;
        }
    }

    .ai-voice-btn,
    .ai-clear-btn {
        border-color: #e5e7eb;
        background: #f9fafb;
        color: #1f2937;

        &:hover:not(:disabled) {
            background: #f3f4f6;
            border-color: #d1d5db;
        }
    }

    .ai-warning {
        background: rgba($ai-warning-color, 0.1);
        border-color: rgba($ai-warning-color, 0.2);
    }
}
