/*
 * O.Translator Tools - Base Styles (V13 - Theme-Aware)
 * ---------------------------------------------------------
 */

/* 1. Global Styles (Light Theme Default) */
:root {
    --action-bar-height: 120px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #F9FAFB; /* gray-50 */
    font-family: 'Inter', sans-serif;
    color: #1F2937; /* gray-800 */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 2. Content Section Components (Light Theme) */
.content-section {
    max-width: 64rem; /* 1024px */
    margin-left: auto;
    margin-right: auto;
    margin-top: 4rem; /* 64px */
    background-color: #ffffff;
    border: 1px solid #E5E7EB; /* gray-200 */
    border-radius: 1rem; /* 16px */
    padding: 2.5rem; /* 40px */
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.section-title {
    font-size: 2.25rem; /* 36px */
    line-height: 2.5rem; /* 40px */
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem; /* 48px */
}

.feature-card { /* For "How to Use" */
    background-color: #F9FAFB; /* gray-50 */
    border: 1px solid #E5E7EB; /* gray-200 */
    border-radius: 0.75rem; /* 12px */
    padding: 1.5rem; /* 24px */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 4rem; /* 64px */
    width: 4rem; /* 64px */
    border-radius: 9999px;
    background-color: #DBEAFE; /* blue-100 */
    color: #1E40AF; /* blue-800 */
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5rem; /* 24px */
    font-weight: 700;
    font-size: 1.5rem; /* 24px */
    line-height: 2rem; /* 32px */
    border: 2px solid #93C5FD; /* blue-300 */
}
.feature-title {
    font-size: 1.125rem; /* 18px */
    line-height: 1.75rem; /* 28px */
    font-weight: 600;
    margin-bottom: 0.5rem; /* 8px */
}
.feature-description {
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    color: #4B5563; /* gray-600 */
}

.feature-highlight-card { /* For "Why Choose Us" */
    display: flex;
    align-items: flex-start;
    padding: 1.5rem; /* 24px */
}
.feature-highlight-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3rem; /* 48px */
    width: 3rem; /* 48px */
    border-radius: 9999px;
    background-color: #DCFCE7; /* green-100 */
    color: #166534; /* green-800 */
    border: 1px solid #86EFAC; /* green-300 */
}
.feature-highlight-title {
    font-size: 1.125rem; /* 18px */
    line-height: 1.75rem; /* 28px */
    font-weight: 700;
}
.feature-highlight-description {
    margin-top: 0.5rem; /* 8px */
    font-size: 1rem; /* 16px */
    line-height: 1.5rem; /* 24px */
    color: #4B5563; /* gray-600 */
}

.faq-item details {
    background-color: #F9FAFB; /* gray-50 */
    border: 1px solid #E5E7EB; /* gray-200 */
    border-radius: 0.5rem; /* 8px */
    margin-bottom: 1rem;
}
.faq-question {
    padding: 1rem; /* 16px */
    font-weight: 600;
    cursor: pointer;
    list-style-type: none;
    display: flex;
    justify-content: space-between;
}
.faq-answer {
    padding: 1rem; /* 16px */
    border-top: 1px solid #E5E7EB; /* gray-200 */
    color: #4B5563; /* gray-600 */
}

.link-card {
    background-color: #F9FAFB; /* gray-50 */
    border: 1px solid #E5E7EB; /* gray-200 */
    border-radius: 0.75rem; /* 12px */
    padding: 1.5rem; /* 24px */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    text-decoration: none;
    color: inherit;
}
.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: #93C5FD; /* blue-300 */
}
.link-card-title {
    font-weight: 700;
    color: #2563EB; /* blue-600 */
}
.link-card:hover .link-card-title {
    color: #1D4ED8; /* blue-700 */
}
.link-card-description {
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    color: #4B5563; /* gray-600 */
    margin-top: 0.5rem; /* 8px */
}

/*
 * Tool-Specific Styles (Light Theme)
 * -----------------------------------------
 */
.tool-wrapper {
    background-color: #ffffff;
    border: 1px solid #E5E7EB; /* gray-200 */
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

#dropZone {
    border: 2px dashed #D1D5DB; /* gray-300 */
    transition: all 0.3s ease;
}
#dropZone.is-hovered {
    border-color: #2563EB; /* blue-600 */
    background-color: #EFF6FF; /* blue-50 */
}
#dropZone svg { color: #6B7280; /* gray-500 */ }
#dropZone .upload-text { color: #1F2937; /* gray-800 */ }
#dropZone .upload-highlight { color: #1D4ED8; /* blue-700 */ }

.loader {
    border: 4px solid #E5E7EB; /* gray-200 */
    border-radius: 50%;
    border-top: 4px solid #3B82F6; /* blue-500 */
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.thumbnail-item {
    position: relative;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    aspect-ratio: var(--aspect-ratio, 1 / 1.414);
}
.thumbnail-item canvas { display: block; width: 100%; height: 100%; }
.thumbnail-item.selected {
    border-color: #3B82F6; /* blue-500 */
    transform: scale(1.03);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2), 0 4px 6px -4px rgba(59, 130, 246, 0.2);
}
.thumbnail-item .page-number {
    position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    color: #1F2937; /* gray-800 */
    padding: 2px 8px;
    font-size: 12px; border-radius: 99px; font-weight: bold;
    border: 1px solid #E5E7EB;
}
.thumbnail-item .selection-check {
    position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2;
    background: #3B82F6; /* blue-500 */
    color: white; width: 24px; height: 24px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); transform: scale(0.5); opacity: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.thumbnail-item.selected .selection-check { transform: scale(1); opacity: 1; }
#page-preview-container.disabled .thumbnail-item { cursor: not-allowed; opacity: 0.6; }
#page-preview-container { padding-bottom: calc(var(--action-bar-height) + 2rem); }

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F3F4F6; /* gray-100 */
}

#action-bar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-top: 1px solid #E5E7EB; /* gray-200 */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    transform: translateY(100%);
    z-index: 50;
}
#action-bar.visible {
    transform: translateY(0);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
#action-bar .action-bar-section {
    border-bottom: 1px solid #E5E7EB; /* gray-200 */
}

.custom-radio input { display: none; }
.custom-radio label {
    transition: all 0.2s ease-in-out;
    border: 2px solid #D1D5DB; /* gray-300 */
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
    color: #4B5563; /* gray-600 */
}
.custom-radio input:checked + label {
    background-color: #EFF6FF; /* blue-50 */
    border-color: #3B82F6; /* blue-500 */
    color: #1E3A8A; /* blue-800 */
}

.control-button {
    transition: all 0.2s ease-in-out;
}
.control-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.control-button:active:not(:disabled) { transform: translateY(-1px); }

.modal { transition: opacity 0.2s ease-in-out; }
.modal-content {
    background-color: #ffffff;
    border: 1px solid #E5E7EB; /* gray-200 */
    transition: transform 0.2s ease-in-out;
}
.context-view { transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out; }

.page-rotation {
    position: absolute; bottom: 0.5rem; left: 0.5rem; z-index: 2;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    color: #1F2937; /* gray-800 */
    padding: 2px 8px;
    font-size: 12px; border-radius: 99px; font-weight: bold;
    border: 1px solid #E5E7EB;
    display: flex; align-items: center;
}
.page-rotation svg { width: 0.75rem; height: 0.75rem; margin-right: 0.25rem; }

.info-box {
    background-color: #EFF6FF; /* blue-50 */
    border-left: 4px solid #3B82F6; /* blue-500 */
    color: #374151; /* gray-700 */
}
.info-box-title { color: #1E3A8A; /* blue-800 */ }

.result-item {
    background-color: #F9FAFB; /* gray-50 */
    border: 1px solid #E5E7EB; /* gray-200 */
}

.loader-light {
    border-top-color: #fff;
}

/*
 * Dark Theme Overrides
 * -----------------------------------------
 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0D1117;
        color: #C9D1D9;
    }

    .content-section {
        background: linear-gradient(145deg, rgba(22, 27, 34, 0.6), rgba(13, 17, 23, 0.4));
        border-color: #30363d;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }

    .section-title {
        color: #ffffff;
        text-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
    }

    .feature-card {
        background-color: rgba(34, 41, 51, 0.5);
        border-color: #30363d;
    }
    .feature-card:hover {
        box-shadow: 0 8px 25px rgba(48, 168, 255, 0.15);
        border-color: #30a8ff;
    }
    .feature-icon {
        background-color: rgba(30, 58, 138, 0.5);
        color: #93c5fd;
        border-color: #1d4ed8;
    }
    .feature-title { color: #ffffff; }
    .feature-description { color: #9ca3af; }

    .feature-highlight-card { background-color: transparent; }
    .feature-highlight-icon {
        background-color: rgba(20, 83, 45, 0.5);
        color: #4ade80;
        border-color: #15803d;
    }
    .feature-highlight-title { color: #ffffff; }
    .feature-highlight-description { color: #9ca3af; }

    .faq-item details {
        background-color: rgba(34, 41, 51, 0.5);
        border-color: #30363d;
    }
    .faq-question { color: #ffffff; }
    .faq-answer { border-color: #374151; color: #9ca3af; }

    .link-card {
        background-color: rgba(34, 41, 51, 0.5);
        border-color: #30363d;
    }
    .link-card:hover {
        box-shadow: 0 8px 25px rgba(48, 168, 255, 0.15);
        border-color: #30a8ff;
    }
    .link-card-title { color: #60a5fa; }
    .link-card:hover .link-card-title { color: #93c5fd; }
    .link-card-description { color: #9ca3af; }

    /* Tool-specific dark overrides */
    .tool-wrapper {
        background-color: #161B22;
        border-color: #30363d;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
    #dropZone { border-color: #30363d; }
    #dropZone.is-hovered {
        border-color: #30a8ff;
        background-color: rgba(48, 168, 255, 0.1);
    }
    #dropZone svg { color: #4a5568; }
    #dropZone .upload-text { color: #c9d1d9; }
    #dropZone .upload-highlight { color: #58a6ff; }

    .loader { border-color: #30363d; border-top-color: #58a6ff; }

    .thumbnail-item {
        background-color: #0D1117;
        border-color: transparent;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    }
    .thumbnail-item.selected {
        border-color: #58a6ff;
        box-shadow: 0 10px 15px -3px rgba(88, 166, 255, 0.2), 0 4px 6px -4px rgba(88, 166, 255, 0.2);
    }
    .thumbnail-item .page-number {
        background: rgba(13, 17, 23, 0.8);
        color: white;
        border-color: #30363d;
    }
    .thumbnail-item .selection-check { background: #58a6ff; }
    .thumbnail-placeholder { background-color: #161B22; }

    #action-bar {
        background-color: rgba(22, 27, 34, 0.85);
        border-top-color: #30363d;
    }
    #action-bar.visible { box-shadow: 0 -4px 20px rgba(0,0,0,0.25); }
    #action-bar .action-bar-section { border-bottom-color: #30363d; }

    .custom-radio label { border-color: #4b5563; color: #8b949e; }
    .custom-radio input:checked + label {
        background-color: rgba(88, 166, 255, 0.1);
        border-color: #58a6ff;
        color: #c9d1d9;
    }

    .modal-content { background-color: #161B22; border-color: #30363d; }

    .page-rotation {
        background: rgba(13, 17, 23, 0.8);
        color: white;
        border-color: #30363d;
    }

    .info-box {
        background-color: rgba(33, 136, 255, 0.1);
        border-left-color: #58a6ff;
        color: #adc6ff;
    }
    .info-box-title { color: #c9d1d9; }

    .result-item {
        background-color: #0D1117;
        border-color: #30363d;
    }
}