/* =========================================
   Global Variables & Reset
========================================= */
:root {
    --primary-color: #4361EE; 
    --secondary-color: #F72585; 
    --bg-color: #F4F7FE; 
    --card-bg: #FFFFFF;
    --text-main: #2B2D42;
    --text-muted: #8D99AE;
    --border-radius: 20px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-color: #0F172A; 
    --card-bg: #1E293B; 
    --text-main: #F8FAFC; 
    --text-muted: #94A3B8; 
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   Navbar (Header)
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s ease;
}

.logo {
    font-size: 20px;
    font-weight: 800;
}

.highlight {
    color: var(--primary-color);
}

.theme-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.theme-btn:hover {
    transform: scale(1.2) rotate(15deg);
}

/* =========================================
   Main Tool Layout
========================================= */
.tool-container {
    display: flex;
    justify-content: center;
    padding: 40px 5%;
}

.tool-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 800px;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: background-color 0.3s ease;
}

.card-header {
    margin-bottom: 10px;
}

.tool-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.hidden {
    display: none !important;
}

/* =========================================
   Upload Area (Drag & Drop)
========================================= */
.upload-area {
    border: 3px dashed var(--primary-color);
    background-color: var(--bg-color);
    padding: 50px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover, .upload-area.dragover {
    background-color: rgba(67, 97, 238, 0.1);
    transform: translateY(-2px);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.upload-icon {
    font-size: 50px;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* =========================================
   Resizer Controls
========================================= */
.resizer-controls {
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dimensions-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 2px solid transparent;
    border-radius: 12px;
    outline: none;
    text-align: center;
    font-weight: 800;
    transition: border-color 0.3s;
}

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

/* =========================================
   Checkbox Group (Keep Aspect Ratio)
========================================= */
.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background-color: var(--bg-color);
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '✔';
    color: white;
    font-size: 16px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
}

/* Quality Slider */
.quality-control {
    margin-bottom: 30px;
    text-align: left;
}

.quality-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.quality-control input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* =========================================
   Buttons & Preview
========================================= */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.action-btn {
    flex: 1;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 800;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
    transition: transform 0.2s, background 0.3s;
}

.action-btn:hover {
    background-color: #324edb;
    transform: translateY(-3px);
}

.secondary-btn {
    background-color: var(--bg-color);
    color: var(--text-main);
    box-shadow: none;
    border: 2px solid var(--text-muted);
}

.secondary-btn:hover {
    background-color: var(--text-muted);
    color: white;
}

.preview-area {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 15px;
    border: 2px dashed rgba(141, 153, 174, 0.3);
}

.preview-title {
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 15px;
}

canvas {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

/* =========================================
   SEO Content & FAQ
========================================= */
.content-section {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s ease;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.content-section p, .content-section ol {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.content-section ol {
    padding-left: 20px;
}

.faq-item {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(141, 153, 174, 0.2);
    padding-bottom: 15px;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

footer {
    text-align: center;
    padding: 30px 5%;
    margin-top: 20px;
    color: var(--text-muted);
}

/* =========================================
   Mobile Responsiveness
========================================= */
@media (max-width: 600px) {
    .tool-card {
        padding: 25px 15px;
    }
    
    .dimensions-grid {
        flex-direction: column;
        gap: 10px;
    }

    .button-group {
        flex-direction: column;
    }
}