/* ============================================
   ZARAZ BANNER DESIGNER - STYLES (Extended)
   ============================================ */

/* === CSS VARIABLES === */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --border-color: #27272a;
    --border-hover: #3f3f46;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --sidebar-width: 320px;
    --code-panel-width: 380px;
    --header-height: 60px;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* === HEADER === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.header-content {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.header-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* === MAIN LAYOUT === */
.main {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--code-panel-width);
    min-height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* === SIDEBAR === */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.section-title svg {
    opacity: 0.7;
}

/* === TEMPLATES GRID === */
.templates-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-category {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.template-card {
    aspect-ratio: 4/3;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
}

.template-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.template-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.template-preview.preview-bar {
    align-items: flex-end;
}

.template-preview.preview-corner {
    align-items: flex-end;
    justify-content: flex-end;
}

.template-preview-inner {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 3px;
}

.preview-bar .template-preview-inner {
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 4px 6px;
    border-radius: 4px 4px 0 0;
}

.preview-corner .template-preview-inner {
    width: 65%;
    height: 70%;
}

.template-preview-inner .tpl-title {
    height: 5px;
    width: 50%;
    background: #1f2937;
    border-radius: 2px;
}

.preview-bar .template-preview-inner .tpl-title {
    width: 30%;
    height: 4px;
}

.template-preview-inner .tpl-text {
    height: 3px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 1px;
}

.preview-bar .template-preview-inner .tpl-text {
    display: none;
}

.template-preview-inner .tpl-buttons {
    display: flex;
    gap: 3px;
    margin-top: auto;
}

.preview-bar .template-preview-inner .tpl-buttons {
    margin-top: 0;
    margin-left: auto;
}

.template-preview-inner .tpl-buttons.tpl-buttons-row {
    flex-direction: row;
}

.template-preview-inner .tpl-btn {
    height: 6px;
    flex: 1;
    border-radius: 2px;
    min-width: 16px;
}

.preview-bar .template-preview-inner .tpl-btn {
    height: 5px;
    flex: none;
    width: 20px;
}

.template-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    font-size: 9px;
    font-weight: 500;
    text-align: center;
}

/* === CONTROL GROUPS === */
.control-group {
    margin-bottom: 14px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group > label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* === COLOR INPUT === */
.color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

.color-text {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.color-text:focus {
    outline: none;
    border-color: var(--accent);
}

/* === SELECT === */
select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

/* === RANGE INPUT === */
.range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-value {
    min-width: 48px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

/* === CHECKBOX === */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* === PREVIEW AREA === */
.preview-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.preview-header h2 {
    font-size: 14px;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-actions select {
    width: auto;
    padding: 8px 32px 8px 12px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* === PREVIEW CONTAINER === */
.preview-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: background 0.3s;
    min-height: 500px;
    max-height: calc(100vh - var(--header-height) - 60px);
}

.preview-container.bg-light {
    background: #f3f4f6;
}

.preview-container.bg-dark {
    background: #1f2937;
}

.preview-container.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.preview-container.bg-image {
    background: url('https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1200') center/cover;
}

.preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-container.show-backdrop .preview-backdrop {
    opacity: 1;
}

/* === CODE PANEL === */
.code-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.code-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--accent-hover);
}

.btn-copy:active {
    transform: scale(0.95);
}

.btn-copy.copied {
    background: var(--success);
}

.code-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.code-content pre {
    margin: 0;
}

.code-content code {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.code-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.code-footer p {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.code-footer strong {
    color: var(--text-secondary);
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--success);
    color: #fff;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   BANNER PREVIEW STYLES (Default)
   ============================================ */

.cf_modal_container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

/* === POSITIONS === */
.cf_modal_container.position-center {
    align-items: center;
    justify-content: center;
    padding: 5%;
}

.cf_modal_container.position-center .cf_modal {
    margin: auto;
    position: static;
}

.cf_modal_container.position-bottom {
    align-items: flex-end;
    justify-content: center;
    padding: 5%;
}

.cf_modal_container.position-bottom .cf_modal {
    max-width: 100%;
    width: 100%;
    border-radius: 16px;
    margin: 0;
    position: static;
}

.cf_modal_container.position-top {
    align-items: flex-start;
    justify-content: center;
    padding: 5%;
}

.cf_modal_container.position-top .cf_modal {
    max-width: 100%;
    width: 100%;
    border-radius: 16px;
    margin: 0;
    position: static;
}

.cf_modal_container.position-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 5%;
}

.cf_modal_container.position-bottom-left .cf_modal {
    max-width: 380px;
    position: static;
}

.cf_modal_container.position-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 5%;
}

.cf_modal_container.position-bottom-right .cf_modal {
    max-width: 380px;
    position: static;
}

.cf_modal_container.position-top-right {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 5%;
}

.cf_modal_container.position-top-right .cf_modal {
    max-width: 360px;
    position: static;
}

.cf_modal_container.position-left {
    align-items: stretch;
    justify-content: flex-start;
    padding: 5%;
}

.cf_modal_container.position-left .cf_modal {
    max-width: 360px;
    width: 360px;
    height: auto;
    max-height: 90%;
    border-radius: 16px;
    margin: 0;
    overflow-y: auto;
    position: static;
}

/* === LAYOUTS === */
.cf_modal_container.layout-bar .cf_modal {
    max-width: 100%;
}

.cf_modal_container.layout-compact .cf_modal {
    max-width: 360px;
}

.cf_modal_container.layout-glass .cf_modal {
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
}

.cf_modal_container.layout-notification .cf_modal {
    max-width: 360px;
}

.cf_modal_container.layout-slim .cf_modal {
    max-width: 100%;
    padding: 16px 24px;
}

.cf_modal_container.layout-slim .cf_consent-container,
.cf_modal_container.layout-slim hr {
    display: none;
}

.cf_modal_container.layout-sidebar .cf_modal {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.cf_modal {
    --padding: 28px;
    background: #ffffff;
    border-radius: 16px;
    max-width: 440px;
    width: calc(100vw - 40px);
    padding: var(--padding);
    border: none;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 10px 40px -10px rgba(0, 0, 0, 0.2),
        0 30px 70px -20px rgba(0, 0, 0, 0.15);
}

.cf_modal .title_container {
    margin-bottom: 12px;
}

.cf_modal h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.cf_modal .cf_consent-intro {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
}

.cf_modal hr {
    border: none;
    height: 1px;
    background: #e5e7eb;
    margin: 16px 0;
}

.cf_modal .cf_consent-container {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.cf_modal .cf_consent-element {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.cf_modal .cf_consent-element:last-child {
    margin-bottom: 0;
}

.cf_modal .cf_consent-element:hover {
    border-color: #d1d5db;
}

.cf_modal .cf_consent-element__checkbox-wrapper {
    grid-row: 1 / 3;
    padding-top: 2px;
}

.cf_modal .cf-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #103663;
    cursor: pointer;
}

.cf_modal .cf_consent-element h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.cf_modal .cf_consent-element p {
    font-size: 12px;
    line-height: 1.5;
    color: #6b7280;
    margin: 0;
}

.cf_modal .cf_consent-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    background: #f9fafb;
    margin: calc(-1 * var(--padding));
    margin-top: 0;
    padding: 18px 20px;
    border-radius: 0 0 16px 16px;
}

.cf_modal .cf_button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 0 18px;
    height: 38px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.cf_modal .cf_button--accept,
.cf_modal .cf_button--reject {
    background: #103663;
    color: #ffffff;
}

.cf_modal .cf_button--accept:hover,
.cf_modal .cf_button--reject:hover {
    filter: brightness(0.9);
}

.cf_modal .cf_button--save {
    background: transparent;
    color: #6b7280;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0 10px;
    height: auto;
}

.cf_modal .cf_button--save:hover {
    color: #1f2937;
}

/* === RESPONSIVE === */
@media (max-width: 1400px) {
    .main {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    
    .code-panel {
        position: fixed;
        right: 0;
        top: var(--header-height);
        transform: translateX(100%);
        transition: transform 0.3s;
        z-index: 50;
    }
    
    .code-panel.open {
        transform: translateX(0);
    }
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 50;
        width: var(--sidebar-width);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}
