:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #212529;
    --card-bg: #ffffff;
    --border-radius: 8px;
    --success-color: #28a745;
    --success-bg: #e2f0e6;
    --error-color: #dc3545;
    --error-bg: #f8d7da;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--light-gray);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
}

.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(80px);
}

.shape1 {
    width: 400px;
    height: 400px;
    background: #007bff;
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: #6f42c1;
    bottom: -150px;
    right: -150px;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
    flex-grow: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-color);
}

header p {
    font-size: 1.1rem;
    color: var(--dark-gray);
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    border: 1px solid var(--medium-gray);
}

#upload-box {
    text-align: center;
    border: 2px dashed transparent;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4rem 2rem;
    position: relative;
    min-height: 190px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#upload-loader {
    text-align: center;
}

#upload-loader p {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--dark-gray);
}

#upload-box:hover, #upload-box.dragover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

#upload-box.dragover {
    border-color: var(--primary-color);
}

#upload-box img {
    transition: transform 0.3s ease;
}

#upload-box:hover img {
    transform: scale(1.1) translateY(-5px);
}

#upload-box p {
    margin: 1rem 0 0;
    font-weight: 500;
    color: var(--dark-gray);
}

/* New layout for converter UI */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: flex-start;
}

#file-list-container {
    max-height: 500px;
    overflow-y: auto;
}

#file-list, #results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item, .result-item {
    display: grid;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
}

.file-item {
    grid-template-columns: 80px 1fr 1fr;
}

.result-item {
    grid-template-columns: 120px 1fr 1fr;
}

.file-item-preview, .result-item-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    background-color: var(--medium-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.file-item-preview img, .result-item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.file-item-details p, .result-item-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.file-item-details p.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-status, .result-item-action {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

.file-item-status {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.result-item-thumbnail-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.result-item-thumbnail-group .button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: 100%;
    max-width: 100px;
}

.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.success {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.status-badge.error {
    background-color: var(--error-bg);
    color: var(--error-color);
}

#results-container {
    margin-top: 2rem;
}

.result-item-action .button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

.panels {
    display: none;
}

.settings-and-actions {
    position: sticky;
    top: 2rem;
}

#actions-panel {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings .setting-group {
    margin-bottom: 1.5rem;
}

.settings label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.settings input[type="number"], .settings select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #fff;
}

.settings small {
    display: block;
    margin-top: 0.5rem;
    color: var(--dark-gray);
    font-size: 0.8rem;
}

.resolution-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Toggle Switch --- */
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-label {
    margin-bottom: 0 !important; /* Override general label margin */
    cursor: default;
}

.toggle-switch-container {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--medium-gray);
    border-radius: 34px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s, left 0.3s;
}

.toggle-switch:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch:checked + .toggle-slider::before {
    left: 26px; /* 50px width - 20px ball - 4px right padding */
}

.button, button {
    display: inline-block;
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

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

button:disabled {
    background-color: var(--medium-gray);
    cursor: not-allowed;
}

.hidden {
    display: none;
}

#loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--medium-gray);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

button#reset-btn {
    background-color: var(--dark-gray);
}
button#reset-btn:hover {
    background-color: var(--text-color);
}

/* --- Blog Page Styles --- */
.blog-header {
    text-align: center;
    margin-bottom: 3rem;
}

.blog-header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-color);
}

.blog-header p {
    font-size: 1.1rem;
    color: var(--dark-gray);
    max-width: 600px;
    margin: 0.5rem auto 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.blog-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--medium-gray);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.blog-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.blog-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-title {
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
    line-height: 1.3;
}

.blog-card-excerpt {
    font-size: 0.95rem;
    color: var(--dark-gray);
    line-height: 1.6;
    margin: 0;
    flex-grow: 1;
}

/* --- Pagination Styles --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

.pagination-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: scale(1.1);
}

.pagination-btn:disabled {
    background-color: var(--medium-gray);
    cursor: not-allowed;
}

#page-info {
    font-weight: 500;
    color: var(--dark-gray);
    min-width: 100px;
    text-align: center;
}

/* --- Site-wide Layout --- */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

.site-header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
    margin-bottom: 2rem;
    width: 100%;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

nav a:hover, nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.site-footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    background-color: #343a40;
    color: var(--light-gray);
    width: 100%;
}

/* Styles for static content pages */
.static-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem 3rem;
    border: 1px solid var(--medium-gray);
    max-width: 900px;
    margin: 0 auto;
}

.static-content h1, .static-content h2, .static-content h3 {
    color: var(--primary-color);
}

.static-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.static-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--medium-gray);
    padding-bottom: 0.5rem;
}

.static-content h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.static-content p, .static-content li {
    line-height: 1.7;
    font-size: 1.05rem;
    color: #333;
}

.static-content ul {
    padding-left: 20px;
}

.static-content strong {
    color: var(--text-color);
}

.static-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.static-content a:hover {
    text-decoration: underline;
}