/* অ্যাপ কন্টেইনারের জন্য সাধারণ স্টাইলিং */
#nid-generator-app {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 960px;
    margin: 30px auto;
    padding: 30px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    background-color: #ffffff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

#nid-generator-app h2 {
    color: #2c3e50;
    font-size: 2.2em;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
    width: 100%;
}

h3 {
    color: #34495e;
    font-size: 1.5em;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

/* ইনপুট সেকশন স্টাইলিং */
.input-section {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    width: 100%;
    padding: 25px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    flex-wrap: wrap; /* ছোট স্ক্রিনে র‍্যাপিং করার অনুমতি দিন */
}

.input-group {
    flex: 1; /* গ্রুপগুলিকে বড় এবং ছোট হতে অনুমতি দিন */
    min-width: 300px; /* প্রতিটি ইনপুট গ্রুপের জন্য সর্বনিম্ন প্রস্থ */
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.input-group label {
    font-weight: 600;
    color: #495057;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.input-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    font-size: 1em;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.input-section input[type="file"]::file-selector-button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    margin-right: 15px;
    transition: background-color 0.2s ease;
}

.input-section input[type="file"]::file-selector-button:hover {
    background-color: #0056b3;
}

/* ইমেজ প্রিভিউ কন্টেইনার এবং ওভারলে */
.image-preview-container {
    position: relative; /* ক্রপ ওভারলের জন্য */
    width: 100%;
    height: 180px; /* সামঞ্জস্যপূর্ণ প্রিভিউর জন্য নির্দিষ্ট উচ্চতা */
    border: 1px solid #ccc;
    background-color: #e9ecef;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-top: 10px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.image-preview-container .image-preview {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.image-preview img, .image-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* প্রিভিউর মধ্যে পুরো ছবি দৃশ্যমান রাখে */
    display: block; /* উপাদানগুলির নিচে অতিরিক্ত স্থান সরিয়ে দেয় */
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    display: none; /* ডিফল্টভাবে লুকানো */
    z-index: 10; /* প্রিভিউ ছবির উপরে রাখুন */
}

/* রোটেশন স্লাইডার এবং ভ্যালু ডিসপ্লে */
.control-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.control-group-inline label {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
    white-space: nowrap; /* টেক্সট এক লাইনে রাখে */
}

.control-group-inline input[type="range"] {
    flex-grow: 1; /* স্লাইডারকে উপলব্ধ স্থান নিতে দিন */
    -webkit-appearance: none;
    height: 10px;
    background: #dcdcdc;
    outline: none;
    opacity: 0.85;
    transition: opacity .2s;
    border-radius: 5px;
    cursor: pointer;
}

.control-group-inline input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.control-group-inline input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.control-group-inline span {
    font-weight: 600;
    color: #333;
    min-width: 40px; /* ভ্যালুর জন্য পর্যাপ্ত স্থান */
    text-align: right;
}


/* কন্ট্রোল প্যানেল স্টাইলিং */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 700px;
    padding: 25px;
    background-color: #f1f8f9;
    border-radius: 10px;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.05);
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 1.05em;
}

.controls-panel input[type="range"] {
    width: 80%; /* স্লাইডারগুলির জন্য অ্যাডজাস্ট করা প্রস্থ */
    -webkit-appearance: none;
    height: 12px;
    background: #dcdcdc;
    outline: none;
    opacity: 0.85;
    transition: opacity .2s;
    border-radius: 6px;
    cursor: pointer;
}

.controls-panel input[type="range"]:hover {
    opacity: 1;
}

.controls-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #007bff;
    cursor: grab;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.controls-panel input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #007bff;
    cursor: grab;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* বাটন গ্রুপ স্টাইলিং */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    width: 100%;
    margin-top: 15px;
}

/* প্রাথমিক বাটন স্টাইল */
.primary-button {
    padding: 14px 30px;
    background-color: #28a745; /* জেনারেটের জন্য সবুজ */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}

.primary-button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.2);
}

/* সেকেন্ডারি বাটন স্টাইল */
.secondary-button {
    padding: 10px 20px;
    background-color: #6c757d; /* ধূসর */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.secondary-button:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* ক্রপ বাটন স্টাইল */
button.crop-button {
    background-color: #ffc107; /* হলুদ */
    color: #333;
    font-weight: 600;
    margin-top: 15px;
}
button.crop-button:hover {
    background-color: #e0a800;
}


/* সফলতার বাটন স্টাইল */
.success-button {
    padding: 14px 30px;
    background-color: #007bff; /* ডাউনলোডের জন্য নীল */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18);
    margin-top: 20px; /* ডাউনলোড বাটনের উপরে স্থান */
}

.success-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


/* আউটপুট সেকশন স্টাইলিং */
.output-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
    margin-top: 20px;
}

.canvas-container {
    border: 2px solid #a0a0a0;
    background-color: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%; /* আউটপুট সেকশনের পুরো প্রস্থ নিন */
    max-width: 600px; /* একত্রিত NID এর সর্বোচ্চ প্রস্থ */
}

#combinedNIDCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    background-color: #fff; /* স্বচ্ছ এলাকার জন্য সাদা ব্যাকগ্রাউন্ড নিশ্চিত করুন */
}

/* স্ট্যাটাস মেসেজ স্টাইলিং */
.status-message {
    margin-top: 25px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    text-align: center;
    width: 100%;
    max-width: 600px;
    display: none; /* ডিফল্টভাবে লুকানো */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.status-message.info {
    background-color: #e0f7fa;
    color: #00838f;
    border: 1px solid #00acc1;
}

.status-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #43a047;
}

.status-message.error {
    background-color: #ffebee;
    color: #d32f2f;
    border: 1px solid #e57373;
}

/* প্রতিক্রিয়াশীল অ্যাডজাস্টমেন্ট */
@media (max-width: 768px) {
    #nid-generator-app {
        margin: 15px auto;
        padding: 15px;
    }

    h2 {
        font-size: 1.8em;
    }

    .input-section {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

    .input-group {
        min-width: unset; /* মোবাইলের জন্য সর্বনিম্ন প্রস্থ সরান */
    }

    .controls-panel {
        padding: 15px;
        gap: 15px;
    }

    .controls-panel input[type="range"] {
        width: 90%;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    .button-group button, .primary-button, .success-button {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }
    
    .canvas-container {
        max-width: 100%; /* ছোট স্ক্রিনে ক্যানভাসকে পুরো প্রস্থ নিতে অনুমতি দিন */
    }
}