*, *::before, *::after { box-sizing: border-box; }

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-image: url("../images/pattern.svg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
    background-color: #0f1f19;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

.container {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 24px;
}

.container h1 {
    text-align: center;
    padding: 0;
    margin: 0 0 14px;
    color: #a0ffa0;
}

form {
    background-color: rgba(0, 0, 0, 0.596);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

form:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 255, 0, 0.3);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #a0ffa0;
    transition: color 0.3s ease;
}

input, textarea, button {
    width: 100%;
    margin-left: 0;
    max-width: 100%;
}

input, textarea {
    padding: 5px;
    margin-bottom: 27px;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: #2c2c2c;
    color: #fff;
    font-size: 16px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #00ff00;
    background-color: #333;
}

textarea { resize: vertical; }

button {
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 16px;
    margin-top: 0;
    padding: 15px;
    background-color: #6cc56c;
    border: none;
    color: #121212;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover { background-color: #00cc00; transform: translateY(-2px); }
button:active { transform: translateY(0); }

button[type="submit"] { position: relative; overflow: hidden; }

.submit-label {
    position: relative;
    z-index: 2;
    display: inline-block;
    min-width: 86px;
    text-align: center;
    letter-spacing: 0.2px;
}

.submit-loader {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 0;
    z-index: 1;
    opacity: 0;
    background: linear-gradient(90deg, #0a2a12 0%, #153f1f 50%, #0a2a12 100%);
    transition: width 0.2s linear, opacity 0.2s ease;
}

button[type="submit"].is-loading { cursor: wait; filter: saturate(0.95) brightness(0.95); }
button[type="submit"].is-loading .submit-loader { opacity: 1; }

.error { color: #ff6161; font-size: 14px; margin-bottom: 15px; }

.tos { font-size: 14px; color: #a0ffa0; text-align: center; margin-top: 5px; margin-bottom: 20px; }
.tos a { color: #00ff00; text-decoration: none; transition: color 0.3s ease; }
.tos a:hover { color: #00cc00; }

.custom-file-input { position: relative; margin-bottom: 10px; }
.custom-file-input input[type="file"] { display: none; }
.custom-file-input label {
    display: block;
    background-color: #6cc56c;
    color: #121212;
    text-align: center;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: normal;
    transition: background-color 0.3s ease;
}
.custom-file-input label:hover { background-color: #00cc00; }

.upload-review { margin: 10px 0 18px; }
.upload-hint { margin: 8px 0 12px; font-size: 13px; color: #c3ffc3; }
.error-message { color: #ff8f8f; font-size: 14px; margin: 0 0 10px; }

.upload-preview-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }

.main-preview-panel, .preview-sidebar {
    border: 1px solid #365036;
    border-radius: 10px;
    background: rgba(26, 26, 26, 0.72);
    padding: 10px;
}

.main-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    border: 1px dashed #4f744f;
    border-radius: 10px;
    overflow: hidden;
    background: #1e1e1e;
    color: #a0ffa0;
    text-align: center;
    font-size: 13px;
    padding: 8px;
    cursor: default;
}
.main-preview img { width: 100%; height: 220px; object-fit: contain; border-radius: 8px; }

.preview-meta { margin-top: 8px; font-size: 12px; color: #c3ffc3; text-align: center; word-break: break-word; }
.preview-header { font-size: 13px; color: #c3ffc3; margin-bottom: 8px; }

.preview-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 10px;
    min-height: 76px;
    max-height: 244px;
    overflow-y: auto;
    margin-top: 0;
    padding: 8px 8px 4px 4px;
}

.preview-image {
    width: 68px;
    height: 68px;
    cursor: pointer;
    overflow: visible;
    position: relative;
    background: transparent;
}
.preview-image img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 6px; background: #1e1e1e; }
.preview-image.active { outline: 2px solid #6cc56c; }
.preview-image button {
    position: absolute;
    top: -8px; right: -8px;
    width: 20px; height: 20px;
    margin: 0; padding: 0;
    line-height: 1; z-index: 3;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.86);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 14px;
}
.lightbox-overlay.open { display: flex; }

.lightbox-content {
    position: relative;
    width: min(96vw, 980px);
    max-height: 94vh;
    background: rgba(18,18,18,0.96);
    border: 1px solid #365036;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.lightbox-image { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 8px; background: #111; }
.lightbox-caption { width: 100%; text-align: center; color: #c3ffc3; font-size: 13px; word-break: break-word; }
.lightbox-controls { display: flex; gap: 10px; width: 100%; justify-content: center; }

.lightbox-btn {
    width: auto;
    min-width: 108px;
    margin: 0;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background: #6cc56c;
    color: #121212;
    font-weight: bold;
    cursor: pointer;
}
.lightbox-btn:hover { background: #00cc00; transform: none; }
.lightbox-btn:disabled { opacity: 0.5; cursor: default; }

.lightbox-close {
    position: absolute;
    top: 8px; right: 8px;
    width: 34px; height: 34px;
    margin: 0; padding: 0;
    border-radius: 50%;
    background: #ff6161;
    color: #fff;
    border: none;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 900px) {
    body { padding: 10px; }
    .container { padding: 8px; }
    form { padding: 16px; }
    .upload-preview-layout { grid-template-columns: 1fr; }
    .main-preview { min-height: 180px; }
    .main-preview img { height: 180px; }
}
