/* Local Fonts */
@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto Mono';
    src: url('fonts/RobotoMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto Mono';
    src: url('fonts/RobotoMono-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #0f1115;
    --bg-card: #161b22;
    --bg-input: #0d1117;
    --primary: #58a6ff;
    --primary-hover: #79c0ff;
    --accent: #bc8cff;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --border: #30363d;
    --font-family: 'Outfit', sans-serif;
    --card-width: 900px;
    --card-height: 300px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    text-align: center;
    background: radial-gradient(circle at top center, #1f242e 0%, var(--bg-dark) 70%);
}

.logo {
    margin-bottom: 60px;
    display: inline-flex;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo svg {
    width: 48px;
    height: 48px;
    margin-right: 12px;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, #4a8eff 100%);
    color: #fff;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(88, 166, 255, 0.3);
}

/* Tool Section */
.tool-section {
    padding: 60px 0 100px;
}

.tool-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
    align-items: start;
}

/* Fix for grid items not shrinking */
.tool-grid>* {
    min-width: 0;
}

@media (max-width: 900px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

/* Controls Panel */
.controls-panel {
    background-color: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.controls-panel h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 24px;
}

/* Preview Column */
.preview-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
    /* Restored gap for spacing between panel and sponsor */
    min-width: 0;
    /* Critical for flex/grid shrinking */
}

@media (min-width: 900px) {
    .preview-column {
        position: sticky;
        top: 40px;
        align-self: start;
    }
}

.preview-panel {
    padding: 30px;
    border-radius: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Sponsor Box */
.sponsor-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-top: 30px;
    padding: 24px;
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s;
}

.sponsor-box:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.sponsor-content {
    flex: 1;
    margin-right: 20px;
}

.sponsor-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.sponsor-box h3 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 8px;
    font-weight: 700;
}

.sponsor-box p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.sponsor-arrow {
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(88, 166, 255, 0.1);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.sponsor-box:hover .sponsor-arrow {
    background-color: var(--primary);
    color: #fff;
}

/* Preview Panel */
.preview-panel {
    background-color: #000;
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Ensure it takes full width of parent */
}

/* Footer Links (Global) */
.footer-left a,
.footer-right a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-left a:hover,
.footer-right a:hover {
    color: var(--primary);
}

.controls-panel h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 24px;
}

.preview-header {
    width: 100%;
    margin-bottom: 20px;
    text-align: left;
}

.preview-header h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.canvas-wrapper {
    /* Scale down the preview if it's too big for the screen, but keep the actual element size for export */
    width: 100%;
    max-width: 100%;
    /* Ensure it doesn't overflow */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 20px 0;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

input[type="text"],
textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Style Controls */
.style-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.half-width {
    flex: 1;
    margin-bottom: 0;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    background: none;
    padding: 0;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

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

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex-input {
    margin-left: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: monospace;
    background: transparent;
    border: none;
    width: 80px;
    outline: none;
    text-transform: uppercase;
}

.color-hex-input:focus {
    color: var(--primary);
}

.range-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: background .15s ease-in-out;
}

.range-slider::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.checkbox-group label {
    margin: 0;
    cursor: pointer;
}

/* Custom File Upload */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-upload-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-button {
    background-color: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-wrapper:hover .file-upload-button {
    border-color: var(--primary);
    color: var(--primary);
}

.action-button {
    width: 100%;
    background-color: var(--primary);
    color: #0f1115;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.action-button:hover {
    background-color: var(--primary-hover);
}

.secondary-button {
    width: 100%;
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.secondary-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}







/* THE CARD DESIGN */
.card {
    width: var(--card-width);
    height: var(--card-height);
    background-color: #fff;
    border-radius: 25px;
    /* White card for clean look, or change to dark */
    display: flex;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    /* Prevent flex shrinking */
    transform-origin: center center;
    /* Scale from center */
    box-shadow: none;
    /* Add shadow for better preview */
    border: none;
    /* Ensure no border */
    transition: box-shadow 0.3s ease;
}

.card.has-shadow {
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.3), 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.card-image-container {
    width: 40%;
    height: 100%;
    overflow: hidden;
    position: relative;
    border: none;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.card-content {
    width: 60%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #ffffff;
    color: #1a1a1a;
    transition: background-color 0.2s, color 0.2s;
}

.card-content h2 {
    line-height: 1.2;
    margin-bottom: 16px;
    font-weight: 700;
    color: inherit;
}

.card-content p {
    color: inherit;
    opacity: 0.8;
    margin-bottom: 30px;
    line-height: 1.5;
}

.card-footer {
    margin-top: auto;
}

#cardLink {
    display: inline-block;
    font-weight: 600;
    color: #2563eb;
    /* Blue link color */
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

/* Footer */
footer {
    background-color: var(--bg-dark);
    padding: 40px 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-left p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.separator {
    color: var(--border);
}

/* Back to Top Button */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
    z-index: 100;
}

#backToTop.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

#backToTop:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* Tip Me Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-header h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-main);
    font-size: 1.5rem;
}

.modal-body p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.modal-footer .btn-primary {
    background: var(--primary);
    color: #0f1115;
    border: none;
}

.modal-footer .btn-primary:hover {
    background: var(--primary-hover);
}

.modal-footer .btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.modal-footer .btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

/* Stacked Layout */
.card.stacked {
    flex-direction: column;
}

.card.stacked .card-image-container {
    width: 100%;
    height: 50%;
}

.card.stacked .card-content {
    width: 100%;
    height: 50%;
    padding: 30px;
}

/* Sponsored Tag */
.sponsor-tag {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sponsor-tag-label {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.sponsor-tag-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}