/* =====================================================
   GLOBAL THEME — DARK GAMER WITH SCARLET GLOW
   ===================================================== */

body {
    background: #0a0a0d;
    color: #f5f5f5;
    margin: 0;
    padding: 30px 0;
    font-family: system-ui, Arial, sans-serif;
}

.card {
    max-width: 820px;
    margin: auto;
    background: #121217;
    border-radius: 18px;
    padding: 32px 42px;
    box-shadow: 0 0 35px rgba(255, 0, 51, 0.15);
    border: 1px solid rgba(255, 0, 51, 0.15);
    animation: fadeIn 0.4s ease-in-out;
}

.title {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 26px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #ff0033;
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.6);
}


/* =====================================================
   LABELS
   ===================================================== */

.label {
    font-size: 16px;
    font-weight: 600;
    color: #e6e6e6;
    margin-bottom: 6px;
    display: block;
}

.label.small {
    font-size: 14px;
}


/* =====================================================
   DROPDOWNS
   ===================================================== */

.dropdown {
    position: relative;
}

.dropdown-selected {
    background: #1b1b22;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #2b2b35;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border 0.15s, box-shadow 0.15s;
}

.dropdown-selected:hover {
    border-color: #ff0033;
    box-shadow: 0 0 12px rgba(255, 0, 51, 0.4);
}

.dropdown-list {
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    max-height: 420px;
    overflow-y: auto;
    background: #14141a;
    border: 1px solid #2b2b35;
    border-radius: 10px;
    z-index: 99;
    padding: 10px;
    display: none;
}

.dropdown-item {
    padding: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.dropdown-item:hover {
    background: #1f1f29;
    box-shadow: inset 0 0 8px rgba(255, 0, 51, 0.25);
}

.dropdown-search {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: none;
    outline: none;
    background: #22222c;
    color: #fff;
}


/* =====================================================
   COLOR PICKERS
   ===================================================== */

.color-row {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
}

.color-picker {
    width: 68px;
    height: 42px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.color-hex {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #2b2b35;
    background: #1b1b22;
    color: #fff;
    font-size: 15px;
}

.color-hex:disabled,
.color-picker:disabled {
    opacity: 0.3;
    cursor: default;
}


/* =====================================================
   SWITCHES (GAMER STYLE)
   ===================================================== */

.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 58px;
    height: 30px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #2b2b35;
    border-radius: 999px;
    transition: background 0.25s;
    border: 1px solid #3a3a45;
}

.slider:before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}

input:checked + .slider {
    background: #ff0033;
    border-color: #ff0033;
    box-shadow: 0 0 16px rgba(255, 0, 51, 0.4);
}

input:checked + .slider:before {
    transform: translateX(28px);
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

input:disabled + .slider {
    opacity: 0.3;
    cursor: default;
}


/* =====================================================
   GRADIENT OPTIONS
   ===================================================== */

.gradient-options {
    background: #15151c;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #22222c;
    margin-bottom: 22px;
    margin-top: 14px;
}

.gradient-grid {
    display: flex;
    gap: 26px;
}

.style-select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #2b2b35;
    background: #1b1b22;
    color: #fff;
}

.angle-slider,
.noise-slider {
    width: 100%;
}

.angle-value {
    text-align: right;
    font-size: 14px;
    opacity: 0.7;
}


/* =====================================================
   PREVIEW WINDOW
   ===================================================== */

.color-preview {
    min-height: 220px;  /* ensures layout matches real output */
    width: 100%;
    background: #111;
    border-radius: 12px;
    border: 1px solid #2b2b35;
    margin-bottom: 28px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.2s;
}

/* ⭐ PERFECT HARD STROKE — matches Python binary_dilation */
.preview-logo-img {
    max-height: 160px;
    opacity: 1;
    filter: url(#logo-stroke);
}


/* =====================================================
   SELECT BOXES
   ===================================================== */

.select {
    width: 100%;
    padding: 14px;
    border: 1px solid #2b2b35;
    border-radius: 10px;
    background: #1b1b22;
    color: #fff;
    margin-bottom: 22px;
}

.select:hover {
    border-color: #ff0033;
}


/* =====================================================
   BUTTONS
   ===================================================== */

.button {
    width: 100%;
    padding: 16px;
    background: #ff0033;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    cursor: pointer;
    margin-bottom: 26px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 16px rgba(255, 0, 51, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}

.button:hover {
    transform: scale(1.02);
    box-shadow: 0 0 22px rgba(255, 0, 51, 0.65);
}

.button:active {
    transform: scale(0.98);
}


/* =====================================================
   PREVIEW OUTPUT
   ===================================================== */

.preview {
    margin-top: 38px;
    text-align: center;
}

.preview-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 18px;
    color: #ff0033;
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.6);
}

.preview-img {
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid #2b2b35;
    box-shadow: 0 0 25px rgba(255, 0, 51, 0.25);
}

.download-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 14px 26px;
    background: #111;
    border-radius: 12px;
    border: 1px solid #ff0033;
    color: #ff0033;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.download-btn:hover {
    box-shadow: 0 0 14px rgba(255, 0, 51, 0.5);
    transform: translateY(-2px);
}


/* =====================================================
   LOADING OVERLAY (RESTORED)
   ===================================================== */

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ff0033;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255,0,51,0.6);
}


/* =====================================================
   UTILITIES
   ===================================================== */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

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