@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Roboto+Mono:wght@300;400;500&display=swap");

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    text-align: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #0f1419 100%);
    background-attachment: fixed;
    color: #e0e6ed;
    margin: 0;
    padding: 2rem;
    font-family: 'Roboto Mono', monospace;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Cyberpunk grid overlay */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 1;
}

/* Main card container */
.main-card {
    position: relative;
    z-index: 2;
    background: rgba(26, 31, 46, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.15),
        inset 0 0 30px rgba(0, 212, 255, 0.02);
    backdrop-filter: blur(10px);
}

/* Header section */
.header-section {
    padding: 1rem;
}

.logo-img {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    border-radius: 8px;
    border: 2px solid rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.logo-img:hover {
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.6);
    transform: scale(1.05);
}

#header {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-top: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Yin and Yang text styling */
.yin {
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
    font-weight: 900;
}

.yang {
    color: #d946ef;
    text-shadow: 0 0 10px rgba(217, 70, 239, 0.8);
    font-weight: 900;
}

.divider {
    color: #6b7280;
}

/* Input section */
.input-section {
    padding: 1rem;
}

#yinyangUrl,
#openaiKey {
    width: 100%;
    max-width: 500px;
    padding: 0.8rem 1.2rem;
    background: rgba(15, 20, 25, 0.8);
    color: #e0e6ed;
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 6px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

#yinyangUrl:focus,
#openaiKey:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

#yinyangUrl::placeholder,
#openaiKey::placeholder {
    color: #6b7280;
}

#openaiKey:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Checkbox styling */
#sklCont {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

#sklCont label {
    margin-left: 0.4rem;
    cursor: pointer;
}

#storeKeyLocally {
    cursor: pointer;
    accent-color: #00d4ff;
}

#sklCont a {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
}

#sklCont a:hover {
    color: #00d4ff;
}

/* Controls */
.controls {
    margin-top: 1.5rem;
}

.threshold-label {
    display: inline-block;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: #00d4ff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

input[type="range"] {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(15, 20, 25, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 3px;
    outline: none;
    margin: 0.5rem 0 1.5rem 0;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00d4ff, #d946ef);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00d4ff, #d946ef);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

/* Cyber button */
.cyber-button {
    padding: 0.8rem 2.5rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(217, 70, 239, 0.1));
    color: #e0e6ed;
    border: 2px solid rgba(0, 212, 255, 0.5);
    border-radius: 6px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.2),
        inset 0 0 10px rgba(0, 212, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.cyber-button:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(217, 70, 239, 0.2));
    border-color: rgba(0, 212, 255, 0.8);
    box-shadow:
        0 0 25px rgba(0, 212, 255, 0.4),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.cyber-button:active {
    transform: translateY(0);
}

/* Source bar - compact horizontal layout */
.source-bar {
    position: relative;
    z-index: 2;
    background: rgba(26, 31, 46, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.1),
        inset 0 0 20px rgba(0, 212, 255, 0.02);
    backdrop-filter: blur(10px);
}

.source-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.source-compact {
    flex: 0 0 auto;
}

#sourceImage {
    max-width: 200px;
    height: auto;
    border: 2px solid rgba(107, 114, 128, 0.6);
    box-shadow: 0 0 15px rgba(107, 114, 128, 0.3);
    background: rgba(0, 0, 0, 0.3);
}

.description-compact {
    flex: 1;
    min-width: 250px;
    max-width: 600px;
    padding: 1rem;
    background: rgba(15, 20, 25, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    text-align: left;
    font-size: 0.9rem;
}

.description-compact span {
    display: block;
    margin: 0.4rem 0;
    padding: 0.2rem;
}

/* Split screen container */
.split-container {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 600px;
    margin-bottom: 2rem;
    gap: 0;
}

/* Split halves */
.split-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
}

/* Yin half - dark/cold */
.yin-half {
    background: linear-gradient(135deg, #050810 0%, #0a0f1a 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow:
        inset 5px 0 30px rgba(0, 212, 255, 0.08),
        0 0 30px rgba(0, 212, 255, 0.15);
}

/* Yang half - lighter/warm */
.yang-half {
    background: linear-gradient(135deg, #1a1525 0%, #251a30 100%);
    border: 1px solid rgba(217, 70, 239, 0.3);
    border-left: none;
    border-radius: 0 8px 8px 0;
    box-shadow:
        inset -5px 0 30px rgba(217, 70, 239, 0.08),
        0 0 30px rgba(217, 70, 239, 0.15);
}

/* Center divider */
.center-divider {
    position: relative;
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.divider-line {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent,
        rgba(0, 212, 255, 0.5) 20%,
        rgba(217, 70, 239, 0.5) 80%,
        transparent);
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.4),
        0 0 20px rgba(217, 70, 239, 0.4);
}

.divider-symbol {
    font-size: 3rem;
    background: linear-gradient(180deg, #00d4ff, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6))
            drop-shadow(0 0 20px rgba(217, 70, 239, 0.6));
    animation: spin 20s linear infinite;
    position: relative;
    z-index: 4;
}

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

/* Split content */
.split-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
}

.split-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.yin-half .split-label {
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 1);
}

.yang-half .split-label {
    color: #d946ef;
    text-shadow: 0 0 20px rgba(217, 70, 239, 1);
}

.split-image {
    width: 100%;
    max-width: 450px;
    height: auto;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.yin-half .split-image {
    border: 3px solid rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    background: rgba(0, 0, 0, 0.5);
}

.yin-half .split-image:hover {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.7);
    transform: scale(1.02);
}

.yang-half .split-image {
    border: 3px solid rgba(217, 70, 239, 0.6);
    box-shadow: 0 0 30px rgba(217, 70, 239, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.yang-half .split-image:hover {
    box-shadow: 0 0 40px rgba(217, 70, 239, 0.7);
    transform: scale(1.02);
}

.split-prompt {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    padding: 0 1rem;
}

/* General images */
img {
    max-width: 100%;
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* Links */
a {
    color: #00d4ff;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

a:hover {
    color: #33dfff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

a:visited {
    color: #00a8cc;
}

/* Footer */
.footer {
    position: relative;
    z-index: 2;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow: 0 -5px 15px rgba(0, 212, 255, 0.05);
}

.footer-content {
    font-size: 0.85rem;
    color: #9ca3af;
    line-height: 1.8;
}

#footer {
    font-family: 'Roboto Mono', monospace;
}

/* Request ID */
.request-id {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 1rem;
    font-family: 'Roboto Mono', monospace;
}

.request-id a {
    color: #6b7280;
}

.request-id a:hover {
    color: #00d4ff;
}

/* Hidden elements */
#sourceDiv {
    display: none;
    visibility: hidden;
    margin-top: 2rem;
}

#reqId {
    display: none;
}

/* Metadata */
#metadata {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

/* Loading spinner customization */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

.text-info {
    color: #00d4ff !important;
    border-color: #00d4ff transparent transparent transparent !important;
}

/* Responsive design */
@media screen and (max-width: 1024px) {
    body {
        padding: 1.5rem;
    }

    .main-card {
        padding: 2rem;
    }

    #header {
        font-size: 1.1rem;
    }

    .split-container {
        min-height: 500px;
    }

    .split-half {
        padding: 2rem 1.5rem;
    }

    .split-image {
        max-width: 350px;
    }

    #sourceImage {
        max-width: 180px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .main-card {
        padding: 1.5rem;
    }

    .header-section {
        margin-bottom: 2rem;
    }

    #yinyangUrl {
        font-size: 0.9rem;
    }

    .cyber-button {
        padding: 0.7rem 2rem;
        font-size: 1.3rem;
    }

    /* Stack split-screen vertically on tablets */
    .split-container {
        flex-direction: column;
        min-height: auto;
    }

    .yin-half {
        border-right: 1px solid rgba(0, 212, 255, 0.3);
        border-bottom: none;
        border-radius: 8px 8px 0 0;
        box-shadow:
            inset 0 5px 30px rgba(0, 212, 255, 0.08),
            0 0 30px rgba(0, 212, 255, 0.15);
    }

    .yang-half {
        border-left: 1px solid rgba(217, 70, 239, 0.3);
        border-top: none;
        border-radius: 0 0 8px 8px;
        box-shadow:
            inset 0 -5px 30px rgba(217, 70, 239, 0.08),
            0 0 30px rgba(217, 70, 239, 0.15);
    }

    .center-divider {
        width: 100%;
        height: 80px;
        flex-shrink: 0;
    }

    .divider-line {
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg,
            transparent,
            rgba(0, 212, 255, 0.5) 20%,
            rgba(217, 70, 239, 0.5) 80%,
            transparent);
    }

    .divider-symbol {
        font-size: 2.5rem;
    }

    .split-half {
        min-height: 400px;
    }

    .source-bar-inner {
        flex-direction: column;
        gap: 1rem;
    }

    #sourceImage {
        max-width: 250px;
    }

    .description-compact {
        max-width: 100%;
    }
}

@media screen and (max-width: 640px) {
    body {
        padding: 0.5rem;
    }

    .main-card {
        padding: 1rem;
    }

    .logo-img {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
    }

    #header {
        font-size: 1rem;
    }

    .source-bar {
        padding: 1rem;
    }

    #sourceImage {
        max-width: 200px;
    }

    .split-half {
        padding: 2rem 1rem;
        min-height: 350px;
    }

    .split-label {
        font-size: 1rem;
        letter-spacing: 3px;
        margin-bottom: 1.5rem;
    }

    .split-image {
        max-width: 280px;
    }

    .split-prompt {
        font-size: 0.85rem;
        margin-top: 1rem;
    }

    .center-divider {
        height: 60px;
    }

    .divider-symbol {
        font-size: 2rem;
    }

    .description-compact {
        font-size: 0.85rem;
        padding: 0.8rem;
    }
}

/* Subtle animation for main card */
@keyframes fadeInGlow {
    from {
        opacity: 0;
        box-shadow: 0 0 0 rgba(0, 212, 255, 0);
    }
    to {
        opacity: 1;
        box-shadow:
            0 0 20px rgba(0, 212, 255, 0.15),
            inset 0 0 30px rgba(0, 212, 255, 0.02);
    }
}

.main-card,
.source-bar,
.split-container {
    animation: fadeInGlow 0.6s ease-out;
}
