/* General Reset and Base Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styling */
.site-header {
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-header h1 {
    font-size: 1.5rem;
}

.anycoder-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.anycoder-link:hover {
    background-color: var(--primary-color);
    color: var(--card-background);
}

/* Main Layout (Mobile-First) */
.container {
    flex-grow: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Section Styling */
.controls-section, .preview-section {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Input File Styling */
#imageInput {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #f1f1f1;
    margin-bottom: 1rem;
}

/* Transformation Controls (Checkbox Styling) */
.transformation-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.hidden {
    display: none !important;
}

/* Custom Checkbox styles */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #eee;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #ccc;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Preview Section */
#canvas-wrapper {
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: #e9ecef;
}

#placeholderText {
    padding: 2rem;
    text-align: center;
    color: var(--secondary-color);
}

#imageCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Footer Styling */
.site-footer {
    padding: 1rem;
    text-align: center;
    background-color: var(--text-color);
    color: var(--background-color);
    margin-top: auto;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .container {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 2rem;
        padding: 2rem;
    }
    
    .site-header h1 {
        font-size: 1.8rem;
    }
    
    .controls-section {
        grid-column: 1 / 2;
        max-height: fit-content;
    }
    
    .preview-section {
        grid-column: 2 / 3;
    }
}

@media (min-width: 1024px) {
    .container {
        grid-template-columns: 1fr 3fr;
    }
}