/* =====================================================
   RESET
===================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


body {

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #e5e7eb;

    color: #111827;

}


/* =====================================================
   HEADER
===================================================== */

.header {

    height: 50px;

    background: #1f2937;

    color: white;

    display: flex;

    align-items: center;

    padding: 0 22px;

}


.brand {

    font-size: 17px;

    font-weight: bold;

}


/* =====================================================
   APP
===================================================== */

.app {

    display: flex;

    gap: 16px;

    padding: 14px;

    min-height:
        calc(100vh - 50px);

}


/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {

    width: 300px;

    flex-shrink: 0;

    background: white;

    border-radius: 10px;

    padding: 16px;

    box-shadow:
        0 2px 12px
        rgba(0,0,0,0.08);

    max-height:
        calc(100vh - 78px);

    overflow-y: auto;

}


.sidebar h2 {

    font-size: 19px;

    margin-bottom: 18px;

}


/* =====================================================
   CONTROLS
===================================================== */

.control {

    margin-bottom: 15px;

    padding-bottom: 13px;

    border-bottom:
        1px solid #e5e7eb;

}


.control label {

    display: block;

    font-size: 13px;

    font-weight: bold;

    margin-bottom: 6px;

}


.control input[type="file"],
.control input[type="number"],
.control select {

    width: 100%;

    min-height: 36px;

    border:
        1px solid #cbd5e1;

    border-radius: 6px;

    background: white;

    padding: 7px;

    font-size: 13px;

}


.control small {

    display: block;

    color: #64748b;

    font-size: 11px;

    margin-top: 5px;

    line-height: 1.4;

}


/* =====================================================
   CUSTOM SIZE
===================================================== */

.custom-size-box {

    display: flex;

    gap: 8px;

    margin-top: -5px;

    margin-bottom: 15px;

}


.custom-size-box > div {

    flex: 1;

}


.custom-size-box label {

    display: block;

    font-size: 11px;

    font-weight: bold;

    margin-bottom: 4px;

}


.custom-size-box input {

    width: 100%;

    padding: 7px;

    border:
        1px solid #cbd5e1;

    border-radius: 6px;

}


/* =====================================================
   CHECKBOX
===================================================== */

.checkbox-row {

    display: flex !important;

    align-items: center;

    gap: 7px;

    cursor: pointer;

}


.checkbox-row input {

    width: auto !important;

    min-height: auto !important;

}


/* =====================================================
   RANGE
===================================================== */

.range-label {

    display: flex;

    justify-content: space-between;

    align-items: center;

}


.range-label label {

    margin-bottom: 0;

}


.range-label span {

    font-size: 12px;

    color: #7c3aed;

    font-weight: bold;

}


input[type="range"] {

    width: 100%;

    accent-color: #7c3aed;

}


/* =====================================================
   MULTIPLE IMAGE INPUTS
===================================================== */

#imageInputs {

    display: flex;

    flex-direction: column;

    gap: 8px;

}


.image-input-row {

    display: flex;

    align-items: center;

    gap: 7px;

    padding: 8px;

    background: #f8fafc;

    border:
        1px solid #d1d5db;

    border-radius: 7px;

    cursor: grab;

}


.image-input-row:hover {

    border-color: #818cf8;

    background: #f5f3ff;

}


.image-input-row.dragging {

    opacity: 0.4;

}


.drag-handle {

    width: 20px;

    color: #64748b;

    font-size: 19px;

    text-align: center;

    cursor: grab;

}


.image-input-content {

    flex: 1;

    min-width: 0;

}


.image-number {

    display: block;

    font-size: 11px;

    font-weight: bold;

    color: #374151;

    margin-bottom: 4px;

}


.multiPhotoInput {

    width: 100% !important;

    min-height: 32px !important;

    padding: 4px !important;

    font-size: 11px !important;

}


.secondary-button {

    width: 100%;

    margin-top: 9px;

    padding: 9px;

    border: none;

    border-radius: 6px;

    background: #2563eb;

    color: white;

    font-weight: bold;

    cursor: pointer;

}


.secondary-button:hover {

    background: #1d4ed8;

}


/* =====================================================
   BORDER
===================================================== */

.border-section {

    padding-bottom: 14px;

}


.border-option {

    margin-top: 10px;

}


.border-option input[type="color"] {

    width: 100%;

    height: 38px;

    padding: 3px;

    cursor: pointer;

}


/* =====================================================
   INFORMATION
===================================================== */

.info-box {

    background: #f3f4f6;

    border-radius: 7px;

    padding: 10px;

    margin-bottom: 10px;

    font-size: 13px;

    line-height: 1.9;

}


.info-box strong {

    float: right;

    color: #111827;

}


/* =====================================================
   BUTTONS
===================================================== */

button {

    font-family: inherit;

}


.edit-button,
.clear-button,
.print-button {

    width: 100%;

    border: none;

    border-radius: 7px;

    padding: 11px;

    margin-bottom: 8px;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;

}


.edit-button {

    background: #7c3aed;

    color: white;

}


.edit-button:hover:not(:disabled) {

    background: #6d28d9;

}


.edit-button:disabled {

    opacity: 0.45;

    cursor: not-allowed;

}


.clear-button {

    background: #e5e7eb;

    color: #374151;

}


.clear-button:hover {

    background: #d1d5db;

}


.print-button {

    background: #16a34a;

    color: white;

    font-size: 15px;

}


.print-button:hover {

    background: #15803d;

}


/* =====================================================
   PREVIEW AREA
===================================================== */

.preview-area {

    flex: 1;

    min-width: 0;

    background: #d1d5db;

    border-radius: 10px;

    padding: 10px;

    overflow: auto;

}


.preview-header {

    height: 42px;

    background: white;

    border-radius: 8px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 15px;

    margin-bottom: 10px;

    font-size: 13px;

}


.preview-header span {

    color: #64748b;

    font-size: 11px;

}


/* =====================================================
   PAPER WRAPPER
===================================================== */

.paper-wrapper {

    display: flex;

    justify-content: flex-start;

    align-items: flex-start;

    min-width: max-content;

    padding: 10px;

}


/* =====================================================
   PAPER
===================================================== */

.paper {

    position: relative;

    background: white;

    flex-shrink: 0;

    box-shadow:
        0 8px 25px
        rgba(0,0,0,0.18);

    overflow: hidden;

}


/* =====================================================
   PHOTO GRID
===================================================== */

.photo-grid {

    position: absolute;

    display: flex;

    flex-wrap: wrap;

    align-content: flex-start;

}


/* =====================================================
   PHOTO ITEM
===================================================== */

.photo-item {

    position: relative;

    flex-shrink: 0;

    overflow: hidden;

    cursor: grab;

    background: white;

}


.photo-item.dragging {

    opacity: 0.45;

}


.photo-item img {

    width: 100%;

    height: 100%;

    display: block;

    object-fit: cover;

}


/* =====================================================
   PREVIEW BADGE
===================================================== */

.photo-badge {

    position: absolute;

    top: 3px;

    left: 3px;

    background: #1f2937;

    color: white;

    border-radius: 3px;

    padding: 2px 5px;

    font-size: 9px;

    z-index: 3;

}


.photo-edit-button {

    position: absolute;

    right: 3px;

    bottom: 3px;

    border: none;

    border-radius: 4px;

    padding: 3px 6px;

    background: rgba(31,41,55,0.85);

    color: white;

    font-size: 9px;

    cursor: pointer;

}


.photo-edit-button:hover {

    background: #111827;

}


/* =====================================================
   EMPTY MESSAGE
===================================================== */

.empty-message {

    width: 100%;

    text-align: center;

    color: #94a3b8;

    padding-top: 100px;

    font-size: 16px;

}


/* =====================================================
   EDITOR MODAL
===================================================== */

.editor-modal {

    position: fixed;

    inset: 0;

    z-index: 9999;

    display: none;

    align-items: center;

    justify-content: center;

    background:
        rgba(0,0,0,0.75);

    padding: 20px;

}


.editor-window {

    width:
        min(950px, 95vw);

    background: white;

    border-radius: 12px;

    overflow: hidden;

    box-shadow:
        0 20px 60px
        rgba(0,0,0,0.5);

}


.editor-header {

    height: 52px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 14px;

    background: #1f2937;

    color: white;

}


.editor-header h2 {

    font-size: 17px;

}


.close-button {

    width: 38px;

    height: 34px;

    border: none;

    border-radius: 5px;

    background: #dc2626;

    color: white;

    font-size: 17px;

    cursor: pointer;

}


.editor-image-area {

    height: 500px;

    background: #222;

    display: flex;

    justify-content: center;

    align-items: center;

    overflow: hidden;

    padding: 10px;

}


.editor-image-area img {

    display: block;

    max-width: 100%;

    max-height: 480px;

}


.editor-tools {

    display: flex;

    justify-content: center;

    flex-wrap: wrap;

    gap: 7px;

    padding: 10px;

    background: #f3f4f6;

}


.editor-tools button {

    border: none;

    border-radius: 6px;

    padding: 9px 13px;

    background: #374151;

    color: white;

    cursor: pointer;

}


.editor-tools button:hover {

    background: #111827;

}


.editor-actions {

    display: flex;

    justify-content: flex-end;

    gap: 8px;

    padding: 10px;

}


.editor-actions button {

    border: none;

    border-radius: 6px;

    padding: 10px 18px;

    color: white;

    cursor: pointer;

}


.cancel-button {

    background: #6b7280;

}


.apply-button {

    background: #16a34a;

}


/* =====================================================
   PRINT
===================================================== */

@media print {

    @page {

        margin: 0;

    }


    * {

        -webkit-print-color-adjust: exact !important;

        print-color-adjust: exact !important;

    }


    body {

        background: white !important;

        margin: 0 !important;

        padding: 0 !important;

    }


    .header,
    .sidebar,
    .preview-header {

        display: none !important;

    }


    .app {

        display: block;

        padding: 0;

        margin: 0;

        min-height: 0;

    }


    .preview-area {

        display: block;

        padding: 0;

        margin: 0;

        background: white;

        overflow: visible;

    }


    .paper-wrapper {

        padding: 0;

        margin: 0;

        display: block;

    }


    .paper {

        box-shadow: none;

        margin: 0;

    }


    .photo-badge,
    .photo-edit-button {

        display: none !important;

    }


    .photo-item {

        cursor: default;

    }


    .editor-modal {

        display: none !important;

    }

}


/* =====================================================
   SMALL SCREEN
===================================================== */

@media (max-width: 850px) {

    .app {

        flex-direction: column;

    }


    .sidebar {

        width: 100%;

        max-height: none;

    }


    .preview-area {

        min-height: 600px;

    }

}