* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.container {
    max-width: 1000px;
    width: 100%;
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

header p {
    color: #64748b;
    margin-bottom: 2rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8fafc;
    cursor: pointer;
    margin-bottom: 1.5rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.drop-icon {
    font-size: 3rem;
    display: block;
}

.drop-zone input[type="file"] {
    display: none;
}

.drop-zone small {
    display: block;
    margin-top: 0.5rem;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.resize-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.resize-controls label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.resize-controls input[type="number"] {
    width: 70px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: scale(1.02);
}

.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background: #e2e8f0;
    border-radius: 999px;
    height: 8px;
    margin: 1rem 0;
    position: relative;
    display: flex;
    align-items: center;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    right: 0;
    top: -1.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}

/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .file-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .remove-btn:hover {
    background: #dc2626;
}

/* ---------- टोस्ट नोटिफिकेशन ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

.toast-success {
    background: rgba(34, 197, 94, 0.9);
}

.toast-error {
    background: rgba(239, 68, 68, 0.9);
}

.toast-info {
    background: rgba(59, 130, 246, 0.9);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- एडिट पेज (मुख्य लेआउट) ---------- */
.edit-container {
    display: flex;
    gap: 1.5rem;
    height: 100vh;
    max-height: 100vh;
    padding: 1rem;
    background: #f1f5f9;
    overflow: hidden;
}

.edit-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    min-width: 0;
}

/* ---- हेडर ---- */
.edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    flex-shrink: 0;
}

.edit-header-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.counter-badge {
    background: #e2e8f0;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
}

.image-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ---- क्रॉपर वाला एरिया ---- */
.cropper-wrapper {
    flex: 1;
    position: relative;
    background: #0f172a;
    min-height: 300px;
    overflow: hidden;
}

.cropper-wrapper img {
    max-width: 100%;
    display: block;
}


/* ---- ओवरले कंट्रोल्स (जूम/रोटेट) ---- */
.cropper-overlay-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.btn-glass {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
}

.zoom-text {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

/* ---- फिल्मस्ट्रिप (थंबनेल) ---- */
.filmstrip-wrapper {
    position: relative;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    flex-shrink: 0;
    height: 90px;
    display: flex;
    align-items: center;
}

.filmstrip {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.3rem 0.3rem 0.3rem 2rem;
    scroll-behavior: smooth;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.filmstrip::-webkit-scrollbar {
    height: 4px;
}

.filmstrip::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.filmstrip-item {
    flex: 0 0 65px;
    height: 65px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filmstrip-item:hover {
    transform: scale(1.05);
}

.filmstrip-item.active {
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.filmstrip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.filmstrip-index {
    position: absolute;
    bottom: 2px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.5rem;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 700;
}

.filmstrip-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    z-index: 5;
    transition: all 0.2s;
    color: #1e293b;
}

.filmstrip-nav:hover {
    background: #f1f5f9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.filmstrip-nav.prev {
    left: 6px;
}

.filmstrip-nav.next {
    right: 6px;
}

/* ---- साइडबार (दायाँ पैनल) ---- */
.edit-sidebar {
    width: 320px;
    min-width: 280px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.edit-sidebar::-webkit-scrollbar {
    width: 4px;
}

.edit-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

/* इन्फो बॉक्स */
.info-box {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 500;
}

/* टूल कार्ड */
.tool-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.tool-header {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.aspect-ratio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.btn-ar {
    padding: 0.2rem 0.8rem;
    border: 1px solid #cbd5e1;
    background: white;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ar:hover {
    background: #f1f5f9;
}

.btn-ar.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.tool-actions {
    display: flex;
    gap: 0.5rem;
}

.tool-actions .btn {
    flex: 1;
}

.resize-inputs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.resize-inputs label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

.resize-inputs input {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 100%;
}

.resize-lock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: #475569;
}

.resize-lock input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

/* ---------- रिस्पॉन्सिव (मोबाइल) ---------- */
@media (max-width: 900px) {
    .edit-container {
        flex-direction: column;
        height: auto;
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .edit-sidebar {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 1rem;
        gap: 0.75rem;
        border-radius: 16px;
    }

    .edit-sidebar .tool-card {
        flex: 1;
        min-width: 140px;
    }

    .edit-sidebar .info-box {
        width: 100%;
    }

    .edit-sidebar .btn-danger {
        margin-top: 0%;
        width: 100%;
    }

    .cropper-wrapper {
        min-height: 300px;
    }

    .edit-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .image-name {
        max-width: 100px;
        font-size: 0.75rem;
    }

    .cropper-overlay-controls {
        bottom: 0.5rem;
        padding: 0.2rem 0.6rem;
    }

    .filmstrip-wrapper {
        height: 70px;
        padding: 0.3rem 0.5rem;
    }

    .filmstrip-item {
        flex: 0 0 50px;
        height: 50px;
    }
}

/* ---------- मोबाइल (≤600px) के लिए अतिरिक्त सुधार ---------- */
@media (max-width: 600px) {
    /* कंटेनर पैडिंग */
    .container {
        padding: 1rem;
    }
    .upload-container {
        padding: 1rem;
    }

    /* अपलोड पेज */
    .drop-zone {
        padding: 1.5rem 1rem;
    }
    .drop-icon {
        font-size: 2.5rem;
    }
    .drop-zone p {
        font-size: 1rem;
    }
    .drop-zone small {
        font-size: 0.7rem;
    }
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    .preview-item .file-name {
        font-size: 0.5rem;
    }

    /* हेडर */
    h1 {
        font-size: 1.5rem;
    }
    header p {
        font-size: 0.85rem;
    }

    /* बटन */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* ---- एडिट पेज (मोबाइल) ---- */
    .edit-container {
        flex-direction: column;
        height: auto;
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .edit-main {
        border-radius: 16px;
        min-height: 70vh;
    }

    /* हेडर */
    .edit-header {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .edit-header-center {
        gap: 0.4rem;
    }
    .counter-badge {
        font-size: 0.7rem;
        padding: 0.1rem 0.6rem;
    }
    .image-name {
        font-size: 0.7rem;
        max-width: 80px;
    }
    .btn-ghost {
        padding: 0.2rem 0.6rem;
        font-size: 0.8rem;
    }

    /* क्रॉपर */
    .cropper-wrapper {
        min-height: 250px;
    }

    /* ओवरले कंट्रोल्स (जूम/रोटेट) */
    .cropper-overlay-controls {
        bottom: 0.5rem;
        padding: 0.2rem 0.6rem;
        gap: 0.3rem;
    }
    .btn-glass {
        font-size: 1rem;
        padding: 0.1rem 0.4rem;
    }
    .zoom-text {
        font-size: 0.65rem;
        min-width: 35px;
    }

    /* फिल्मस्ट्रिप */
    .filmstrip-wrapper {
        height: 65px;
        padding: 0.3rem 0.5rem;
    }
    .filmstrip {
        gap: 0.3rem;
        padding-left: 1.8rem;
    }
    .filmstrip-item {
        flex: 0 0 45px;
        height: 45px;
        border-radius: 8px;
    }
    .filmstrip-index {
        font-size: 0.4rem;
        bottom: 1px;
        right: 2px;
        padding: 0 3px;
    }
    .filmstrip-nav {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    .filmstrip-nav.prev { left: 4px; }
    .filmstrip-nav.next { right: 4px; }

    /* साइडबार (नीचे आ जाएगा) */
    .edit-sidebar {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.75rem;
        gap: 0.5rem;
        border-radius: 16px;
        max-height: 400px;
        overflow-y: auto;
    }
    .edit-sidebar .info-box {
        width: 100%;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    .edit-sidebar .tool-card {
        flex: 1 1 45%;
        min-width: 120px;
        padding: 0.6rem;
    }
    .edit-sidebar .tool-header {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }
    .edit-sidebar .btn-danger {
        width: 100%;
        margin-top: 0.25rem !important;
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    /* टूल के अंदर */
    .aspect-ratio-group {
        gap: 0.3rem;
    }
    .btn-ar {
        padding: 0.1rem 0.6rem;
        font-size: 0.65rem;
    }
    .resize-inputs {
        flex-direction: column;
        gap: 0.3rem;
    }
    .resize-inputs label {
        font-size: 0.65rem;
    }
    .resize-inputs input {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    .resize-lock {
        font-size: 0.7rem;
        gap: 0.3rem;
    }
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    .tool-actions {
        flex-wrap: wrap;
    }
    .tool-actions .btn {
        flex: 1 1 40%;
        min-width: 60px;
    }

    /* टोस्ट (नोटिफिकेशन) */
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        align-items: stretch;
    }
    .toast {
        padding: 10px 16px;
        font-size: 0.85rem;
        min-width: unset;
        text-align: center;
    }
}

/* ---------- बहुत छोटी स्क्रीन (≤400px) ---------- */
@media (max-width: 400px) {
    .edit-sidebar .tool-card {
        flex: 1 1 100%;
    }
    .filmstrip-item {
        flex: 0 0 40px;
        height: 40px;
    }
    .cropper-wrapper {
        min-height: 200px;
    }
    .image-name {
        max-width: 60px;
    }
}
/* ड्रैग-ड्रॉप के दौरान हाइलाइट */
.filmstrip-item.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(59,130,246,0.3);
}
.filmstrip-item.dragging {
    opacity: 0.4;
}
/* अपलोड प्रीव्यू में हटाएँ बटन */
.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.preview-item .remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}