:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

.layout {
    position: relative;
    max-width: 1520px;  /* Total width: content(1200px) + 2*sidebar(160px) */
    margin: 0 auto;
    min-height: 100vh;
    padding-top: 1rem;
}

.container {
    width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.sidebar {
    width: 160px;
    position: fixed;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
}

.sidebar-left {
    left: calc(50% - 830px);  /* Fine-tuned position */
}

.sidebar-right {
    right: calc(50% - 760px);  /* Half of total width (1520px/2 = 760px) */
}

.sticky-ad {
    background-color: #f1f5f9;
    border: 2px dashed #cbd5e1;
    padding: 2rem 1rem;
    text-align: center;
    color: #64748b;
    font-weight: 500;
    border-radius: 0.25rem;
    height: 600px;
    width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1600px) {
    .layout {
        max-width: 1320px;  /* Total width: content(1000px) + 2*sidebar(160px) */
    }
    .container {
        width: 1000px;
    }
    .sidebar-left {
        left: calc(50% - 730px);  /* Fine-tuned position */
    }
    .sidebar-right {
        right: calc(50% - 660px);  /* Half of total width (1320px/2 = 660px) */
    }
}

@media (max-width: 1400px) {
    .layout {
        max-width: 1120px;  /* Total width: content(800px) + 2*sidebar(160px) */
    }
    .container {
        width: 800px;
    }
    .sidebar-left {
        left: calc(50% - 630px);  /* Fine-tuned position */
    }
    .sidebar-right {
        right: calc(50% - 560px);  /* Half of total width (1120px/2 = 560px) */
    }
}

@media (max-width: 1200px) {
    .sidebar {
        display: none;
    }
    .container {
        width: 100%;
        max-width: 1000px;
    }
}

header {
    position: sticky;
    top: 0;
    width: 100%;
    text-align: center;
    background: linear-gradient(to right, #2563eb, #1d4ed8);
    color: white;
    z-index: 1000;
    padding: 1rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (max-width: 1600px) {
    .header-content {
        max-width: 1000px;
    }
}

@media (max-width: 1400px) {
    .header-content {
        max-width: 800px;
    }
}

@media (max-width: 1200px) {
    .header-content {
        width: 100%;
        max-width: 1000px;
    }
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header-logo {
    width: 50px;
    height: 50px;
    background-color: white;
    border-radius: 10px;
    padding: 8px;
}

h1 {
    font-size: 2.5rem;
    color: white;
    margin: 0;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.welcome-section {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.welcome-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-section p {
    font-size: 1.1rem;
    color: var(--text-color);
    max-width: 800px;
    margin: 0 auto;
}

.how-it-works {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.step-item {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: 0.5rem;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-weight: bold;
}

.related-tools {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tool-card {
    background-color: var(--background-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.tool-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.ad-banner {
    margin: 1rem 0 2rem;
    padding: 1rem;
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.ad-placeholder {
    background-color: #f1f5f9;
    border: 2px dashed #cbd5e1;
    padding: 2rem;
    text-align: center;
    color: #64748b;
    font-weight: 500;
    border-radius: 0.25rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.upload-section {
    margin-bottom: 2rem;
}

.dropzone {
    background-color: var(--surface-color);
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

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

.upload-prompt svg {
    stroke: var(--primary-color);
    margin-bottom: 1rem;
}

.editor-section {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.image-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .image-preview {
        grid-template-columns: 1fr;
    }
}

.preview-container {
    text-align: center;
}

canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.image-info {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.controls {
    display: grid;
    gap: 1.5rem;
}

.control-group {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: 0.375rem;
}

.dimension-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="number"],
select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 1rem;
}

input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.checkbox-label {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-button {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

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

.faq-section {
    margin-top: 3rem;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.faq-question {
    font-weight: 600;
    padding: 1rem 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary-color);
}

.faq-item.active .faq-question::after {
    content: '-';
}

.faq-answer {
    padding: 0 0 1rem;
    display: none;
}

.faq-item.active .faq-answer {
    display: block;
}

footer {
    margin-top: 3rem;
    padding: 3rem 0;
    background-color: #1e293b;
    color: #f8fafc;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-section h3 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section p {
    color: #cbd5e1;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
    text-align: center;
    color: #94a3b8;
}
