:root {
    /* Devold Brand Palette (Extracted directly from devold.com) */
    --devold-red: #bd1415; 
    --wool-white: #f5f6f7;
    --fjord-blue: #384f5a;
    --devold-yellow: #ffd900;
    --charcoal: #afb9bd;
    --light-grey: #e1e5e7;
    
    /* System Colors - Upgraded to a slicker, deeper theme */
    --bg-color: #050505; /* True dark background for premium feel */
    --panel-bg: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #88959c; /* Using Devold's grey color from CSS extraction */
    --input-bg: rgba(255, 255, 255, 0.03);
    
    /* Typography - More premium */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Shadows & Transitions */
    --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Snappier, more apple-like easing */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* Elegant subtle gradient background */
    background: radial-gradient(circle at 15% 50%, rgba(189, 20, 21, 0.08), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(56, 79, 90, 0.12), transparent 25%);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* -------------------- SIDEBAR -------------------- */
.controls-sidebar {
    width: 420px; /* Slightly wider for better breathing room */
    background: var(--panel-bg);
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 40px 32px 32px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--text-primary);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    background-color: var(--devold-red);
    border-radius: 50%;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
}

.control-groups {
    padding: 0 32px 32px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 32px; /* More spacing between elements */
    
    /* Custom Scrollbar for elegance */
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
}
.control-groups::-webkit-scrollbar { width: 6px; }
.control-groups::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 10px; }

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px; /* More space between label and input */
}

.control-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* API Settings specific styles */
.api-settings-group {
    background: rgba(0,0,0,0.2);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.api-hint {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: -4px;
    opacity: 0.6;
}

.label-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-link {
    background: transparent;
    border: none;
    color: var(--devold-yellow);
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition-smooth);
}

.action-link:hover {
    color: #fff;
    transform: scale(1.05);
}

.action-link:disabled {
    color: var(--text-secondary);
    cursor: wait;
    opacity: 0.5;
}

/* Inputs */
input[type="text"],
input[type="url"],
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px; /* Softer radius */
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: var(--transition-smooth);
}

input:focus, textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.02);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Format Toggles */
.format-toggles {
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 6px;
    gap: 6px;
}

.format-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.format-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.format-btn.active {
    background: var(--fjord-blue); /* Use brand color for active state */
    color: #ffffff;
    box-shadow: inherit;
}

/* Color Picker */
.color-picker-group {
    display: flex;
    gap: 16px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.color-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

.color-btn:hover {
    transform: scale(1.05);
}

.color-btn.active::after {
    border-color: rgba(255, 255, 255, 0.8);
}

/* Footer & Buttons */
.sidebar-footer {
    padding: 32px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--panel-border);
}

.primary-btn {
    width: 100%;
    background: var(--text-primary);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.primary-btn:hover {
    background: var(--devold-yellow);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 217, 0, 0.2);
}

/* -------------------- PREVIEW AREA -------------------- */
.preview-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    border-bottom: 1px solid var(--panel-border);
}

.preview-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.preview-dims {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.preview-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    overflow: auto;
}

/* -------------------- THE AD UNIT (Premium Design) -------------------- */
.ad-unit {
    background: var(--wool-white); 
    border-radius: 0; /* Keep sharp for brutalist/scandinavian feel */
    box-shadow: 0 40px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease, width 0.5s cubic-bezier(0.16, 1, 0.3, 1), height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
}

/* Layout for Image and Content */
.ad-image-container {
    position: relative;
    overflow: hidden;
    background: #111;
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ad-unit:hover .ad-image {
    transform: scale(1.05); /* Slower, more elegant zoom */
}

/* Gradient overlay to ensure logo visibility */
.ad-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

.ad-devold-logo {
    position: absolute;
    top: 32px;
    left: 32px;
    width: 140px;
    z-index: 2;
    /* Change SVG color to white via CSS filter trick for dark backgrounds */
    filter: brightness(0) invert(1) drop-shadow(0px 2px 8px rgba(0,0,0,0.4));
}

.ad-content-container {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--wool-white);
    color: var(--fjord-blue); 
    transition: background-color 0.4s ease, color 0.4s ease;
}

.ad-text-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ad-headline {
    font-size: 32px;
    font-weight: 300; /* Lighter weight for premium feel */
    line-height: 1.1;
    letter-spacing: -1px;
}

.ad-headline strong {
    font-weight: 700;
}

.ad-copy {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    opacity: 0.8;
}

.ad-cta-container {
    margin-top: 40px;
}

.ad-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background-color: var(--devold-red);
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    transition: var(--transition-smooth);
    border-radius: 0; /* Keep it sharp */
}

.ad-cta::after {
    content: '→';
    font-size: 16px;
    transition: transform 0.3s ease;
}

.ad-cta:hover {
    opacity: 0.9;
}

.ad-cta:hover::after {
    transform: translateX(4px);
}

/* -------------------- FORMAT SPECIFIC SIZES -------------------- */
/* LinkedIn Sponsored Content: 1200 x 628 -> 720 x 376 */
.ad-unit.linkedin-format {
    width: 760px;
    height: 398px;
    flex-direction: row;
}
.linkedin-format .ad-image-container { width: 55%; height: 100%; }
.linkedin-format .ad-content-container { width: 45%; height: 100%; padding: 40px; }
.linkedin-format .ad-headline { font-size: 28px; }
.linkedin-format .ad-copy { font-size: 15px; }

/* Facebook / Instagram Square: 1080 x 1080 -> 540 x 540 */
.ad-unit.facebook-format {
    width: 540px;
    height: 540px;
    flex-direction: column;
}
.facebook-format .ad-image-container { width: 100%; height: 60%; }
.facebook-format .ad-content-container { width: 100%; height: 40%; padding: 32px 40px; justify-content: flex-start; }
.facebook-format .ad-headline { font-size: 26px; }
.facebook-format .ad-cta-container { margin-top: auto; }

/* Display Banner: 300 x 600 */
.ad-unit.display-format {
    width: 320px;
    height: 640px;
    flex-direction: column;
}
.display-format .ad-image-container { width: 100%; height: 50%; }
.display-format .ad-content-container { width: 100%; height: 50%; padding: 32px; }
.display-format .ad-headline { font-size: 24px; }
.display-format .ad-copy { font-size: 14px; }
.display-format .ad-cta { width: 100%; justify-content: space-between; padding: 16px 24px;}
