body { margin: 0; padding: 0; min-height: 100vh; }

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
}

.grid-cell {
    position: relative;
    aspect-ratio: 1;
    background: #2a2a2a;
    overflow: hidden;
    cursor: move;
    transition: transform 0.2s, opacity 0.2s;
}

.grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.grid-cell .w-full.h-full {
    position: relative;
    width: 100%;
    height: 100%;
}

.preview-container {
    position: fixed;
    inset: 0;
    background: #0f0f0f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    z-index: 1000;
    padding: 20px;
}

.preview-image-container {
    width: 90vw;
    max-width: 920px;
    height: calc(90vh - 200px);
    background: #000;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image { 
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.split-options {
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
}

.split-option {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    color: white;
    background: transparent;
    cursor: pointer;
}

.split-option.active { background: #4f46e5; }

.split-preview {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
    cursor: move;
    user-select: none;
}

.split-preview.vertical {
    cursor: ew-resize;
}

.split-preview.square {
    cursor: default;
}

.split-line {
    position: absolute;
    background: white;
    opacity: 0.8;
    pointer-events: none;
}

.split-line::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.add-button {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #4f46e5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    cursor: pointer;
}

.plus-icon {
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: white;
    font-size: 24px;
    cursor: pointer;
}

.cell-menu {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-cell:hover .cell-menu {
    opacity: 1;
}

.cell-menu-buttons {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.cell-menu-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.cell-menu-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.cell-menu-button.delete {
    background: rgba(239, 68, 68, 0.15);
}

.cell-menu-button.delete:hover {
    background: rgba(239, 68, 68, 0.25);
}

.cell-menu-button i {
    font-size: 18px;
}

.cell-menu-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.bottom-buttons {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
    width: 100%;
    justify-content: center;
    padding: 0 20px;
    text-align: center;
}

.bottom-buttons button{
    display: flex;
    justify-content: center;
}

@media screen and (max-width: 768px){
    .bottom-buttons{
        flex-direction: column;
    }
}

.download-all-button {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-all-button .fa-minus {
    margin-right: 0.5rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: #1f1f1f;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.3s ease;
}

.modal-title {
    color: white;
    font-size: 20px;
    padding: 24px;
    text-align: center;
    background: #2d2d2d;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-options {
    padding: 24px;
}

.modal-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.modal-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 16px;
    font-weight: 500;
}

.modal-option {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px;
    background: #2d2d2d;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    margin-bottom: 12px;
}

.modal-option:last-child {
    margin-bottom: 0;
}

.modal-option:hover {
    background: #3d3d3d;
    transform: translateY(-2px);
}

.modal-option svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-cell.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.grid-cell.drag-over {
    background: #3d3d3d;
    transform: scale(1.05);
}

.cropper-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 920px !important;
    max-height: none !important;
}

.crop-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 920px;
}

.crop-button {
    padding: 12px 32px;
    font-size: 16px;
    border-radius: 6px;
}

.crop-button:hover {
    background: #4338ca;
}

.crop-button.cancel {
    background: #ef4444;
}

.grid-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    padding: 16px;
}

.grid-option-button {
    background: #2d2d2d;
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.grid-option-button:hover {
    background: #3d3d3d;
    transform: translateY(-2px);
}

.grid-option-button.active {
    background: #4f46e5;
}

.grid-preview {
    width: 60px;
    height: 60px;
    background: #1a1a1a;
    position: relative;
}

.cropper-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

.cropper-view-box {
    outline: none;
    border: none;
}

.cropper-face {
    background-color: transparent;
}

.cropper-grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ratio-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.ratio-button {
    background: #2d2d2d;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.ratio-button:hover {
    background: #3d3d3d;
    transform: translateY(-1px);
}

.ratio-button.active {
    background: #4f46e5;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.crop-image {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
}

.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

.cropper-wrap-box {
    background-color: #000;
}

.cropper-canvas {
    max-width: none !important;
    max-height: none !important;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    color: white;
    gap: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-cell-upload {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.empty-cell-upload:hover {
    background: rgba(0, 0, 0, 0.2);
}

.empty-cell-buttons {
    display: flex;
    gap: 1rem;
}

.empty-cell-action {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    background: rgba(79, 70, 229, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.empty-cell-action:hover {
    background: rgb(79, 70, 229);
    transform: scale(1.1);
}

.empty-cell-action i {
    font-size: 1.25rem;
}

.cell-upload-button {
    padding: 8px 16px;
    background: #4f46e5;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.cell-action-button {
    padding: 8px;
    background: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-action-button svg {
    width: 16px;
    height: 16px;
}

.modal-option {
    width: 100%;
    background: #2d2d2d;
    border: none;
    border-radius: 12px;
    padding: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.modal-option:last-child {
    margin-bottom: 0;
}

.modal-option:hover {
    background: #3d3d3d;
    transform: translateY(-2px);
}

.modal-option svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #4f46e5;
}

.modal-option span {
    font-size: 14px;
    color: #e5e7eb;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    transform-origin: top center;
    backdrop-filter: blur(4px);
    white-space: nowrap;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    opacity: 0;
}

.cell-menu-button {
    position: relative;
}

.cell-menu-button:hover .tooltip {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

/* Add these modal styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-container {
    background: #2a2a2a;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-icon {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #4a5568;
    color: white;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 900;
}

.search-icon:hover {
    background: #2d3748;
    transform: scale(1.05);
}

.search-icon i {
    font-size: 1.5rem;
}

/* Rest of the modal styles */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #404040;
}

.modal-title {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.search-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    background: #404040;
    border: 1px solid #505050;
    color: #fff;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.search-result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
    gap: 1rem;
}

.search-loading i {
    font-size: 2rem;
}

.grid-color-picker {
    background: #2d2d2d;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.grid-color-picker input[type="color"] {
    -webkit-appearance: none;
    border: none;
    padding: 0;
    background: transparent;
}

.grid-color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.grid-color-picker input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.grid-color-picker input[type="range"] {
    -webkit-appearance: none;
    background: #404040;
    height: 4px;
    border-radius: 2px;
}

.grid-color-picker input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4f46e5;
    border-radius: 50%;
    cursor: pointer;
}

.grid-color-picker select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.grid-color-picker input[type="range"] {
    height: 4px;
    border-radius: 2px;
    background: #4f46e5;
}

.grid-color-picker input[type="range"]::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    background: #ffffff;
    border: 2px solid #4f46e5;
    border-radius: 50%;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
}

.grid-color-picker input[type="color"] {
    padding: 0;
    border: 2px solid #4f46e5;
}

.grid-color-picker input[type="number"] {
    appearance: none;
    -moz-appearance: textfield;
}

.grid-color-picker input[type="number"]::-webkit-outer-spin-button,
.grid-color-picker input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.grid-color-picker select {
    background-color: #1f1f1f;
    border: 1px solid #404040;
    height: 40px;
}

.grid-color-picker input[type="number"] {
    background-color: #1f1f1f;
    border: 1px solid #404040;
    height: 40px;
}

.download-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 0 0 8px 8px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #2d2d2d;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: #4f46e5;
    transition: width 0.3s ease;
}

.progress-status {
    color: #fff;
    font-size: 0.875rem;
    text-align: center;
}

.cropper-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.crop-confirm-button {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #4f46e5;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    z-index: 9999;
}

.crop-confirm-button:hover {
    background: #4338ca;
    transform: translateX(-50%) scale(1.05);
}

.crop-confirm-button i {
    font-size: 1.25rem;
}