@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #0f0f0f;
    color: #e0e0e0;
    padding: 2rem;
    box-sizing: border-box;
}

.main-wrapper {
    display: grid;
    grid-template-columns: 1fr 600px 1fr;
    align-items: start;
    gap: 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.container {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #333;
    width: 100%;
    /* Add this to prevent overflow */
    max-width: 100%;
    box-sizing: border-box;
}

/* === FIXED SECTION: Info Box Styling === */
.info-box-wrapper {
    /* Ensure proper sizing and prevent overflow */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.info-box {
    color: #aaa;
    font-size: 0.9rem;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    /* Ensure proper sizing */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Add positioning to prevent stacking */
    position: relative;
    z-index: 1;
}
/* === END FIXED SECTION === */

.info-box h3 {
    color: #e0e0e0;
    border-bottom: 1px solid #444;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.info-box ol {
    padding-left: 20px;
    line-height: 1.8;
}

.info-box li {
    margin-bottom: 0.75rem;
}

.info-box a {
    color: #0099ff;
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

#drop-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 300px;
    overflow-y: auto;
    background-color: #2a2a2a;
    border: 2px dashed #444;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 1rem;
    box-sizing: border-box;
    margin-bottom: 2rem;
}

#drop-area:hover {
    border-color: #008f00;
    box-shadow: 0 0 15px rgba(0, 143, 0, 0.4);
}

#drop-area.highlight {
    border-color: #00ff00;
    background-color: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

#drop-area-text {
    color: #aaa;
    font-size: 1.1rem;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

#preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.preview-img {
    height: 100px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #555;
    flex-shrink: 0;
}

.preview-img:only-child {
    height: auto;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
}

#drop-area.has-image #drop-area-text { display: none; }

.options-title { text-align: center; color: #ccc; margin-bottom: 1.5rem; border-bottom: 1px solid #333; padding-bottom: 1rem; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.option { display: flex; flex-direction: column; }
.option-full-width { grid-column: 1 / -1; }
label { margin-bottom: 0.5rem; font-weight: 500; color: #bbb; }
#max-words-value, #precision-value-span { color: #fff; font-weight: 600; }

#quota-info-container {
    margin-top: -0.5rem;
}
.quota-title {
    font-size: 0.9em;
    font-weight: 500;
    color: #bbb;
}
.quota-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    border: 1px solid #444;
    padding: 1rem;
    border-radius: 8px;
    background-color: #2a2a2a;
}
.quota-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #ccc;
}
.quota-value {
    font-weight: 600;
    color: #fff;
    background-color: #383838;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.quota-note {
    display: block;
    font-size: 0.8em;
    color: #888;
    font-style: italic;
    text-align: center;
    margin-top: 0.5rem;
}

#kohya-options-container {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    border: 1px solid #444;
    padding: 1rem;
    border-radius: 8px;
    margin-top: -0.5rem;
}
#kohya-options-container .option:last-child {
    grid-column: 1 / -1;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #444;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    cursor: pointer;
}
input[type="range"]:hover {
    opacity: 1;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
}

input[type="password"], 
input[type="number"], 
input[type="text"], 
select, 
textarea { 
    padding: 0.75rem; 
    border: 1px solid #444; 
    background-color: #2a2a2a; 
    color: #e0e0e0; 
    border-radius: 6px; 
    width: 100%; 
    box-sizing: border-box; 
    font-family: inherit; 
    transition: border-color 0.2s; 
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #007bff; }

.export-option { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; }
.export-option input[type="checkbox"] { width: auto; }
.export-option label { margin-bottom: 0; }
.info-button { text-decoration: none; color: #fff; background-color: #007bff; border-radius: 50%; padding: 0.1rem 0.5rem; font-size: 0.8rem; }

#start-btn, .button { display: block; width: 100%; padding: 0.85rem; border: none; background-color: #007bff; color: white; border-radius: 6px; font-size: 1.1rem; cursor: pointer; text-align: center; margin-top: 1rem; transition: background-color 0.2s; }
#start-btn:hover, .button:hover { background-color: #0056b3; }
#start-btn:disabled { background-color: #555; cursor: not-allowed; }
#start-btn.stop-btn { background-color: #dc3545; }
#start-btn.stop-btn:hover { background-color: #c82333; }

#output-area { margin-top: 2rem; width: 100%; }
#output-area h2 { text-align: center; }
#results-container { padding: 1rem; border-radius: 8px; border: 1px solid #333; background-color: #2a2a2a; display: flex; flex-direction: column; gap: 1rem; max-height: 450px; overflow-y: auto; }

.result-item { 
    display: flex; 
    align-items: flex-start; 
    gap: 1rem; 
    border-bottom: 1px solid #444; 
    padding-bottom: 1rem; 
}
.result-item:last-child { 
    border-bottom: none; 
}

.result-left-column {
    display: flex;
    flex-direction: column;
    width: 90px;
    flex-shrink: 0;
}

.result-img { 
    width: 90px; 
    height: 90px; 
    object-fit: cover; 
    border-radius: 4px;
}

.result-text {
    width: 100%;
    background-color: #1f1f1f;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem;
    font-family: inherit;
    color: #e0e0e0;
    box-sizing: border-box;
    height: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.copy-btn {
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.copy-btn:hover { 
    background-color: #666; 
}
.copy-btn.copied { 
    background-color: #28a745; 
}

#download-zip-btn { background-color: #28a745; margin-top: 1rem; }
#download-zip-btn:hover { background-color: #218838; }

/* === RESPONSIVE FIXES === */
@media (max-width: 1200px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .info-box-wrapper:first-child {
        order: 1;
    }
    
    .container {
        order: 2;
    }
    
    .info-box-wrapper:last-child {
        order: 3;
    }
}
