/* Campaign Builder Styles */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Gradient backgrounds */
.gradient-sunset { background: linear-gradient(135deg, #f97316, #dc2626); }
.gradient-ocean { background: linear-gradient(135deg, #2563eb, #312e81); }
.gradient-forest { background: linear-gradient(135deg, #22c55e, #047857); }
.gradient-midnight { background: linear-gradient(135deg, #334155, #0f172a); }
.gradient-neon { background: linear-gradient(135deg, #d946ef, #9333ea); }
.gradient-gold { background: linear-gradient(135deg, #facc15, #f97316); }

/* Mobile Frame */
.mobile-frame {
    width: 280px;
    background: white;
    border-left: 4px solid #1e293b;
    border-right: 4px solid #1e293b;
    border-top: 20px solid #1e293b;
    border-bottom: 20px solid #1e293b;
    border-radius: 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

.mobile-frame::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 96px;
    height: 16px;
    background: #1e293b;
    border-radius: 0 0 12px 12px;
    z-index: 30;
}

/* Browser Frame */
.browser-frame {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.browser-toolbar {
    background: #f1f5f9;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.browser-dots {
    display: flex;
    gap: 4px;
}

.browser-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.browser-dot.red { background: #f87171; }
.browser-dot.yellow { background: #fbbf24; }
.browser-dot.green { background: #4ade80; }

.browser-url {
    flex: 1;
    margin: 0 8px;
    background: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    color: #94a3b8;
    font-family: monospace;
    text-align: center;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Instagram Frame */
.instagram-frame {
    max-width: 350px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.instagram-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.instagram-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #9333ea);
    padding: 2px;
}

.instagram-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: white;
    border: 2px solid transparent;
}

.instagram-footer {
    padding: 12px;
}

.instagram-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.instagram-actions-left {
    display: flex;
    gap: 12px;
}

/* Email Frame */
.email-frame {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 400px;
    max-height: 600px;
}

.email-header {
    background: #fafafa;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.email-header h2 {
    font-size: 16px;
    word-break: break-word;
    white-space: normal;
}

.email-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: white;
}

.email-body p {
    word-break: break-word;
}

/* Email responsive */
@media (max-width: 640px) {
    .email-frame {
        min-height: 350px;
        max-height: 450px;
        border-radius: 6px;
    }
    
    .email-header {
        padding: 10px 12px;
    }
    
    .email-header h2 {
        font-size: 14px !important;
        line-height: 1.3;
    }
    
    .email-body {
        padding: 12px;
    }
    
    .email-body p {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }
    
    .email-body a {
        display: inline-block;
        padding: 10px 16px !important;
        font-size: 12px !important;
    }
}

/* Creative Content */
.creative-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.creative-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    mix-blend-mode: multiply;
}

.creative-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 10;
}

.creative-text-inner {
    text-align: center;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.creative-event-label {
    font-size: 1.875rem;
    font-weight: 900;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 8px;
}

.creative-location-label {
    font-size: 1.25rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Visual Brief Overlay */
.visual-brief-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.creative-content:hover .visual-brief-overlay {
    opacity: 1;
}

.visual-brief-label {
    color: #94a3b8;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 8px;
}

.visual-brief-text {
    color: white;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    max-width: 200px;
}

/* Story/TikTok overlay text */
.story-text-overlay {
    position: absolute;
    bottom: 48px;
    left: 16px;
    right: 64px;
    z-index: 10;
    pointer-events: none;
}

.story-text-box {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    padding: 12px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.story-text-box p {
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

/* Social Actions (vertical) */
.social-actions {
    position: absolute;
    bottom: 80px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    z-index: 20;
}

.social-action-btn {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 50%;
    color: white;
    backdrop-filter: blur(4px);
}

/* Play button for video */
.play-button {
    margin-top: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Web overlays */
.sticky-bar-overlay {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    z-index: 30;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.sticky-bar-text {
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.sticky-bar-btn {
    background: white;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.hero-overlay {
    position: absolute;
    bottom: 32px;
    left: 32px;
    z-index: 30;
    max-width: 400px;
}

.hero-headline {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-cta {
    background: #4f46e5;
    color: white;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transition: background 0.2s ease;
}

.hero-cta:hover {
    background: #4338ca;
}

/* Popup overlay */
.popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.popup-card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 320px;
    width: 100%;
    position: relative;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

.popup-image {
    height: 128px;
    border-radius: 4px;
    margin-bottom: 16px;
    overflow: hidden;
}

.popup-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.popup-text {
    font-size: 14px;
    color: #475569;
    margin-bottom: 16px;
}

.popup-btn {
    width: 100%;
    background: #4f46e5;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

/* Editor styles */
.editor-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    padding: 24px;
    margin-bottom: 16px;
}

.editor-section-title {
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    color: #334155;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group {
    margin-bottom: 16px;
}

/* Color picker */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid transparent;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: #4f46e5;
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* Asset list item */
.asset-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.asset-item:hover {
    background: #f8fafc;
    border-color: #f1f5f9;
}

.asset-item.selected {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.asset-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asset-item:not(.selected) .asset-icon {
    background: #f1f5f9;
    color: #64748b;
}

.asset-item.selected .asset-icon {
    background: #c7d2fe;
    color: #4338ca;
}

.asset-info {
    flex: 1;
    min-width: 0;
}

.asset-title {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-item.selected .asset-title {
    color: #312e81;
}

.asset-subtitle {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-delete-btn {
    opacity: 0;
    padding: 6px;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.asset-item:hover .asset-delete-btn {
    opacity: 1;
}

.asset-delete-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* Creative with background image */
.creative-bg-image {
    background-size: cover;
    background-position: center;
    position: relative;
}

.creative-bg-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(0,0,0,0.5));
}

/* LinkedIn preview */
.linkedin-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.linkedin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: #e2e8f0;
}

.linkedin-name {
    height: 8px;
    width: 96px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 4px;
}

.linkedin-subtitle {
    height: 6px;
    width: 64px;
    background: #f1f5f9;
    border-radius: 4px;
}

.linkedin-link-preview {
    background: #fafafa;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 4px 4px;
    margin-bottom: 8px;
}

.linkedin-link-title {
    font-size: 12px;
    font-weight: 600;
}

.linkedin-link-url {
    font-size: 10px;
    color: #94a3b8;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

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

.animate-scale-in {
    animation: scaleIn 0.2s ease;
}

/* Preview container */
.preview-wrapper {
    transition: transform 0.3s ease;
}

.preview-wrapper:hover {
    transform: scale(1.01);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Mobile Navigation Tabs */
.mobile-nav {
    display: none;
}

.mobile-tab {
    color: #94a3b8;
    border-color: transparent;
}

.mobile-tab.active {
    color: #4f46e5;
    border-color: #4f46e5;
}

.mobile-tab:not(.active):hover {
    color: #64748b;
    background: #f8fafc;
}

/* Panel visibility on mobile */
@media (max-width: 1023px) {
    .mobile-nav {
        display: flex;
    }
    
    .panel-assets,
    .panel-editor,
    .panel-preview {
        display: none !important;
    }
    
    .panel-assets.active,
    .panel-editor.active,
    .panel-preview.active {
        display: flex !important;
    }
}

/* Small screens */
@media (max-width: 640px) {
    /* Mobile Frame scaling */
    .mobile-frame {
        width: 240px;
        border-left-width: 3px;
        border-right-width: 3px;
        border-top-width: 16px;
        border-bottom-width: 16px;
        border-radius: 28px;
    }
    
    .mobile-frame::before {
        width: 72px;
        height: 12px;
        top: -11px;
    }
    
    .mobile-frame > div {
        height: 420px !important;
    }
    
    /* Instagram Frame scaling */
    .instagram-frame {
        max-width: 300px;
    }
    
    .instagram-header {
        padding: 10px;
    }
    
    .instagram-avatar {
        width: 28px;
        height: 28px;
    }
    
    .instagram-footer {
        padding: 10px;
    }
    
    /* Email Frame scaling */
    .email-frame {
        height: 500px;
    }
    
    .email-header {
        padding: 12px;
    }
    
    .email-body {
        padding: 16px;
    }
    
    /* Creative text scaling */
    .creative-event-label {
        font-size: 1.5rem;
    }
    
    .creative-location-label {
        font-size: 1rem;
    }
    
    .creative-text {
        padding: 16px;
    }
    
    /* Editor styles */
    .editor-section {
        padding: 16px;
        margin: 8px;
        border-radius: 8px;
    }
    
    .form-input {
        padding: 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-textarea {
        min-height: 80px;
    }
    
    /* Color picker */
    .color-picker-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    
    .color-swatch {
        width: 28px;
        height: 28px;
    }
    
    /* Web overlays */
    .hero-overlay {
        bottom: 16px;
        left: 16px;
        max-width: 280px;
    }
    
    .hero-headline {
        font-size: 1.125rem;
    }
    
    .hero-cta {
        padding: 10px 20px;
        font-size: 12px;
    }
    
    .sticky-bar-overlay {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .sticky-bar-text {
        font-size: 12px;
        flex: 1;
        min-width: 0;
    }
    
    .sticky-bar-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .popup-card {
        padding: 16px;
        max-width: 280px;
    }
    
    .popup-image {
        height: 100px;
    }
    
    .popup-title {
        font-size: 1rem;
    }
    
    .popup-text {
        font-size: 12px;
    }
    
    /* Toast */
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
    }
    
    /* Asset list item - touch friendly */
    .asset-item {
        padding: 14px 12px;
    }
    
    .asset-delete-btn {
        opacity: 1; /* Always show on mobile */
        padding: 8px;
    }
}

/* Medium screens (tablet) */
@media (min-width: 641px) and (max-width: 1023px) {
    .editor-section {
        padding: 20px;
        margin: 12px;
    }
    
    /* Make previews slightly smaller on tablet */
    .mobile-frame {
        width: 260px;
    }
    
    .instagram-frame {
        max-width: 320px;
    }
}

/* Large screens - show all panels */
@media (min-width: 1024px) {
    .panel-assets,
    .panel-editor,
    .panel-preview {
        display: flex !important;
        position: relative !important;
    }
}

/* Extra large screens */
@media (min-width: 1280px) {
    .editor-section {
        padding: 28px;
    }
}

/* Handle very small height screens (landscape mobile) */
@media (max-height: 600px) {
    .mobile-frame > div {
        height: 360px !important;
    }
    
    .email-frame {
        height: 400px;
    }
}

/* Browser frame responsive */
@media (max-width: 768px) {
    .browser-frame {
        border-radius: 6px;
    }
    
    .browser-toolbar {
        padding: 6px 10px;
    }
    
    .browser-dot {
        width: 8px;
        height: 8px;
    }
    
    .browser-url {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    /* Fix LinkedIn post spacing on mobile */
    .linkedin-header {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .linkedin-avatar {
        width: 32px;
        height: 32px;
    }
    
    .linkedin-link-preview {
        padding: 6px;
    }
    
    .linkedin-link-title {
        font-size: 11px;
    }
    
    .linkedin-link-url {
        font-size: 9px;
    }
}

/* Ensure touch targets are large enough */
@media (pointer: coarse) {
    .asset-item {
        min-height: 56px;
    }
    
    .asset-delete-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .color-swatch {
        min-width: 36px;
        min-height: 36px;
    }
    
    .mobile-tab {
        min-height: 60px;
    }
}

/* Print styles */
@media print {
    .mobile-nav,
    header,
    .panel-assets,
    .panel-editor {
        display: none !important;
    }
    
    .panel-preview {
        display: block !important;
        position: static !important;
    }
}
