:root {
    --blue: #e74c3c; /* PDF Red Brand Color */
    --blue-hover: #c0392b;
    --red-bg: #f4c7c7;
    --red-text: #d32f2f;
    --gray-btn: #9aa0a6;
    --gray-hover: #7d8389;
    --border-dashed: #aabfe3;
}

body {
    background-color: #f0f4f9;
}

.tool-container {
    max-width: 900px;
    margin: 40px auto;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.tool-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    padding: 30px;
    position: relative;
    z-index: 2;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

/* --- Controls --- */
.top-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
    justify-content: center;
}

.btn-blue {
    background: var(--blue);
    color: white;
    border: none;
    padding: 12px 25px;
    font-weight: 700;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-blue:hover { background: var(--blue-hover); }

.btn-red {
    background: var(--red-bg);
    color: var(--red-text);
    border: none;
    padding: 12px 25px;
    font-weight: 700;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-red:hover { opacity: 0.8; }

/* --- Drop Zone --- */
.drop-zone-box {
    width: 100%;
    flex-grow: 1;
    border: 2px dashed var(--border-dashed);
    border-radius: 12px;
    background: #fdfdfd;
    position: relative;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 25px;
}

.drop-zone-box:hover, .drop-zone-box.drag-active {
    background: #f0f7ff;
    border-color: var(--blue);
}

.drop-msg {
    pointer-events: none;
    text-align: center;
}

.drop-text {
    font-size: 22px;
    color: #aabfe3;
    font-weight: 700;
}

/* --- Preview Grid --- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    width: 90%;
    padding: 20px;
    z-index: 10;
}

.img-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }

.img-del {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(255,0,0,0.8);
    color: white;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

/* --- Bottom Download --- */
.bottom-controls {
    width: 100%;
    text-align: center;
    position: relative;
}

.btn-gray {
    background: var(--gray-btn);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: 0.3s;
}
.btn-gray:hover { background: var(--gray-hover); }

.btn-gray.disabled {
    background: #d0d0d0;
    cursor: default;
}

.badge {
    background: #7d8389;
    color: white;
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}
.btn-gray:not(.disabled) .badge {
    background: var(--blue);
}
/* --- PARAMETER CONTROLS --- */
.param-controls {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    width: 100%;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 15px;
    justify-content: center;
}
.param-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align labels to the left */
    gap: 8px;
    flex: 1; /* Allow groups to grow */
    min-width: 180px; /* Minimum width for each group */
}
.param-group label {
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 5px;
}
.param-group input[type="checkbox"] {
    margin-right: 5px;
}
.param-group input[type="text"],
.param-group select {
    width: 100%; /* Take full width of parent */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem; /* Make text readable */
}
.param-group select {
    background: #fff url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="10" viewBox="0 0 14 10"><path d="M2 2l4.5 4.5L11 2" stroke="%23333" fill="none" stroke-width="2"/></svg>') no-repeat right 10px center;
    background-size: 12px 10px;
    appearance: none; /* Remove default dropdown arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
}
/* Styles for OCR Language Select */
.param-group select[id="ocrRecognitionLang"] {
    background-size: 10px 8px; /* Adjust size for smaller arrow */
}