:root {
    --bg-color: #f2f2f2;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --accent: #52ab98;
    --accent-hover: #3d8a78;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.05);
    --success: #10b981;
    --error: #ef4444;
    --header-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Header & Navigation */
.main-header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo h1 {
    font-size: 1.5rem;
    color: var(--accent);
    text-decoration: none;
}

.header-logo {
    height: 75px;
    width: auto;
    object-fit: contain;
    display: block;
    transform: scale(0.9);
    transform-origin: left center;
}

.nav-logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--accent);
}

/* Page Layout */
.page-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 1rem;
}

.container {
    width: 100%;
    max-width: 650px;
    z-index: 1;
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Tool Dashboard Grid (for Index page) */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 900px;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--card-border);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
}

.tool-icon {
    background: rgba(82, 171, 152, 0.1);
    color: var(--accent);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Form & Tool Container */
.tool-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed rgba(82, 171, 152, 0.4);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(82, 171, 152, 0.02);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(82, 171, 152, 0.08);
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.drop-hint {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Buttons and Inputs */
.text-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Conversion Panel */
.conversion-panel {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Updated Previews */
.file-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    width: 100%;
}

.preview-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.file-icon {
    font-size: 1.5rem;
    background: var(--card-bg);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.file-details {
    overflow: hidden;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    font-weight: 500;
}

/* Options */
.conversion-options {
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.custom-select {
    appearance: none;
    background-color: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent);
}

.action-area {
    margin-bottom: 1rem;
}

.primary-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Area w/ Preview */
.result-area {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.result-preview-box {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.result-thumbnail {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 4px solid white;
    object-fit: contain;
    background: #e2e8f0;
}

.success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--success);
    font-weight: 500;
    margin-bottom: 1rem;
}

.download-btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    text-decoration: none;
    padding: 0.875rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(82, 171, 152, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(82, 171, 152, 0.4);
}

.app-footer {
    text-align: center;
    padding: 3rem 2rem 1.5rem;
    color: var(--text-secondary);
    background-color: var(--header-bg);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid var(--card-border);
}

.footer-content {
    max-width: 500px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-logo {
    height: 100px;
    width: auto;
    object-fit: contain;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.footer-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.footer-links {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    width: 100%;
    max-width: 1000px;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: #9ca3af;
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .nav-logo {
        align-self: center;
    }

    .nav-menu {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        scrollbar-width: none;
        /* Firefox */
        gap: 1.25rem;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .tool-container {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }
}