:root {
    --blue: #2d70d6;
    --blue-hover: #1c5bbd;
    --red-bg: #f4c7c7;
    --red-text: #d32f2f;
    --gray-btn: #9aa0a6;
    --gray-hover: #7d8389;
    --border-dashed: #aabfe3;
    --text-main: #333;
}

body { background-color: #f0f4f9; font-family: 'Segoe UI', Roboto, sans-serif; }

/* --- Main Card --- */
.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;
    max-width: 800px;
    margin: 0 auto;
}

/* --- Top Controls --- */
.top-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-blue, .btn-red {
    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 { background: var(--blue); color: white; }
.btn-blue:hover { background: var(--blue-hover); }

.btn-red { background: var(--red-bg); color: var(--red-text); }
.btn-red:hover { opacity: 0.8; }

/* --- Settings Area (Sliders/Inputs) --- */
.settings-area {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
}

.setting-group input[type="range"] { accent-color: var(--blue); cursor: pointer; width: 150px; }
.setting-group input[type="number"] { padding: 6px; border: 1px solid #ccc; border-radius: 4px; width: 80px; text-align: center; }

/* --- 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; }
.drop-sub { font-size: 14px; color: #999; margin-top: 8px; }

/* --- 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);
    background: #fff;
    border: 1px solid #eee;
}
.img-thumb img { width: 100%; height: 100%; object-fit: contain; }

.img-del {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

/* --- 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;
    transition: 0.3s;
}
.btn-gray:hover { background: var(--gray-hover); }
.btn-gray.disabled { background: #d0d0d0; cursor: default; }

.badge {
    background: rgba(0,0,0,0.2);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
/* --- CROPPER TOOL STYLES --- */
.cropper-container-box {
    width: 100%;
    height: 500px;
    background: #333; /* Dark bg for easier cropping */
    margin-bottom: 20px;
    display: none; /* Hidden until image uploaded */
    border-radius: 8px;
    overflow: hidden;
}

#crop-image-element {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.crop-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 15px;
    display: none; /* Hidden until active */
}

/* Override existing drop-zone behavior for Cropper */
.tool-card[data-tool="crop"] .drop-zone-box.hidden {
    display: none;
}