/**
 * HTML5 Ad Manager - Enhanced Styles
 * Enterprise-level UI for live preview carousel and campaign management
 */

/* Campaign Banner */
.campaign-banner {
    margin-bottom: 24px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInFromTop 0.4s ease-out;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
    flex: 1;
}

.banner-content > i {
    font-size: 2rem;
    opacity: 0.9;
}

.banner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.banner-text strong {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.banner-text span {
    font-size: 1.25rem;
    font-weight: 600;
}

.banner-stats {
    display: flex;
    gap: 24px;
    color: white;
    font-size: 0.9375rem;
}

.banner-stats span {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.95;
}

.banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Live Preview Carousel */
.preview-carousel-section {
    margin-bottom: 32px;
    padding: 24px;
    animation: fadeInScale 0.5s ease-out;
}

.carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.carousel-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: #1F2937;
    margin: 0;
}

.carousel-header i {
    color: var(--accent, #8E7CC3);
}

.carousel-controls {
    display: flex;
    gap: 8px;
}

.carousel-btn {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: var(--accent, #8E7CC3);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent, #8E7CC3);
    transform: translateY(-2px);
}

.carousel-container {
    position: relative;
    margin: 20px 0;
}

.carousel-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 16px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent, #8E7CC3) #E5E7EB;
}

.carousel-track::-webkit-scrollbar {
    height: 8px;
}

.carousel-track::-webkit-scrollbar-track {
    background: #E5E7EB;
    border-radius: 4px;
}

.carousel-track::-webkit-scrollbar-thumb {
    background: var(--accent, #8E7CC3);
    border-radius: 4px;
}

.carousel-track::-webkit-scrollbar-thumb:hover {
    background: #4F46E5;
}

.carousel-ad-preview {
    min-width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s;
    flex-shrink: 0;
}

.carousel-ad-preview:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

.carousel-ad-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carousel-ad-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.carousel-ad-body {
    position: relative;
    background: #F9FAFB;
}

.carousel-iframe-wrapper {
    position: relative;
    width: 100%;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.carousel-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.carousel-ad-meta {
    padding: 12px 16px;
    display: flex;
    gap: 16px;
    border-top: 1px solid #E5E7EB;
}

.carousel-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #6B7280;
}

.carousel-meta-item i {
    color: #9CA3AF;
}

.carousel-ad-controls {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #E5E7EB;
}

.carousel-ad-btn {
    flex: 1;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--accent, #8E7CC3);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.carousel-ad-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.carousel-ad-btn.playing {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-nav:hover {
    background: var(--accent, #8E7CC3);
    border-color: var(--accent, #8E7CC3);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
    left: -20px;
}

.carousel-nav.next {
    right: -20px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    background: #D1D5DB;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-indicator.active {
    width: 24px;
    background: var(--accent, #8E7CC3);
    border-radius: 4px;
}

/* Campaign Section */
.campaign-section {
    margin-bottom: 32px;
    padding: 24px;
    animation: fadeInScale 0.5s ease-out;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: #1F2937;
    margin: 0 0 8px 0;
}

.section-header i {
    color: var(--accent, #8E7CC3);
}

.section-subtitle {
    color: #6B7280;
    font-size: 0.9375rem;
    margin: 0;
}

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

.campaign-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.summary-item > i {
    font-size: 2rem;
    color: var(--accent, #8E7CC3);
}

.summary-item div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-item strong {
    font-size: 1.5rem;
    color: #1F2937;
}

.summary-item span {
    font-size: 0.875rem;
    color: #6B7280;
}

.campaign-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Artemis Assistant Widget */
.artemis-assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.widget-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

.widget-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
}

.widget-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideInFromBottom 0.3s ease-out;
}

.widget-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border-radius: 16px 16px 0 0;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 600;
}

.widget-actions {
    display: flex;
    gap: 8px;
}

.widget-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.3s ease-out;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.message-content {
    flex: 1;
    background: #F3F4F6;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.message-content li {
    margin: 4px 0;
}

.chat-suggestions {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-btn {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: var(--accent, #8E7CC3);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.suggestion-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent, #8E7CC3);
    transform: translateX(4px);
}

.widget-footer {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent, #8E7CC3);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Targeting Modal */
.large-modal {
    max-width: 900px;
    width: 90vw;
}

.targeting-search {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.targeting-search input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9375rem;
}

.targeting-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 24px;
}

.targeting-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9CA3AF;
}

.targeting-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.targeting-item {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.targeting-item:hover {
    background: #F9FAFB;
}

.targeting-item:last-child {
    border-bottom: none;
}

.targeting-item-content {
    flex: 1;
}

.targeting-item-name {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
}

.targeting-item-desc {
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.5;
}

.targeting-item-action button {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent, #8E7CC3) 0%, var(--primary, #9ED9F5) 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.targeting-item-action button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.targeting-selected {
    margin-top: 24px;
}

.targeting-selected h3 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    color: #1F2937;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-tag {
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent, #8E7CC3);
    font-weight: 500;
    font-size: 0.875rem;
}

.selected-tag button {
    background: none;
    border: none;
    color: var(--accent, #8E7CC3);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.selected-tag button:hover {
    opacity: 1;
}

/* Animations */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .widget-panel {
        width: calc(100vw - 48px);
        max-height: calc(100vh - 200px);
    }

    .carousel-ad-preview {
        min-width: 300px;
    }

    .campaign-summary {
        grid-template-columns: 1fr;
    }

    .carousel-nav {
        display: none;
    }
}
