/* Base Styles */
:root {
    --primary-bg: #1E2124;
    --secondary-bg: #121315;
    --primary-accent: #267F3B;
    --secondary-accent: #C41E3A;
    --text-color: #FFFFFF;
    --secondary-text: #B8B9BA;
    --border-color: #343638;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary-text);
    margin-bottom: 2rem;
}

p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

code, pre {
    font-family: 'Source Code Pro', monospace;
}

/* Layout */
.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.step-screen {
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    padding: 2rem 0;
}

/* Code Display */
.code-container {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    color: var(--secondary-text);
}

/* Input Screen */
.input-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
    position: relative;
}

textarea {
    width: 100%;
    min-height: 300px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    color: var(--text-color);
    font-family: 'Source Code Pro', monospace;
    resize: vertical;
    margin-bottom: 1rem;
}

/* Buttons */
button {
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.next-button {
    background-color: var(--primary-accent);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: 4px;
    margin-top: auto;
    align-self: flex-end;
    font-weight: 600;
}

.next-button:hover {
    background-color: #1f6530;
}

.secondary-button {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border-radius: 4px;
    align-self: flex-end;
}

.secondary-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

#use-example {
    position: absolute;
    right: 0;
    top: 0;
    margin: 0.5rem;
}

/* Results Display */
#analysis-container {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 200px;
}

/* Error Message Styling */
.error-message {
    background-color: rgba(196, 30, 58, 0.1);
    border-left: 4px solid var(--secondary-accent);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 4px 4px 0;
}

.error-message h3 {
    color: var(--secondary-accent);
    margin-bottom: 0.75rem;
}

.error-message p {
    color: var(--secondary-text);
    margin-bottom: 0.75rem;
}

.error-message p:last-child {
    margin-bottom: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

p.error {
    color: var(--secondary-accent);
    background-color: rgba(196, 30, 58, 0.1);
    padding: 1rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Loading Animation Container */
#loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    overflow: hidden;
}

/* Card Animation */
.flying-card {
    position: absolute;
    width: 40px;
    height: 56px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: var(--secondary-accent);
    animation: fly 10s linear infinite;
}

.flying-card.spade, .flying-card.club {
    color: black;
}

.flying-card.heart, .flying-card.diamond {
    color: var(--secondary-accent);
}

.flying-card:nth-child(2n) {
    animation-duration: 14s;
}

.flying-card:nth-child(3n) {
    animation-duration: 12s;
}

.flying-card:nth-child(4n) {
    animation-duration: 16s;
}

@keyframes fly {
    0% {
        transform: translate(calc(-50vw - 100px), calc(50vh - 200px)) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(50vw + 100px), calc(-50vh + 200px)) rotate(360deg);
        opacity: 0;
    }
}

.loading-text {
    position: relative;
    color: var(--text-color);
    font-size: 1.5rem;
    z-index: 20;
    text-align: center;
    background-color: rgba(30, 33, 36, 0.7);
    padding: 1rem 2rem;
    border-radius: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Convergence Ninja Logo */
.convergence-link {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 5;
}

.convergence-link a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.convergence-link a:hover {
    color: var(--text-color);
}

.convergence-link img {
    height: 30px;
    margin-right: 10px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .next-button {
        align-self: center;
        width: 100%;
    }
    
    .convergence-link {
        position: static;
        margin-top: 2rem;
        text-align: center;
        padding-bottom: 1rem;
    }
    
    .convergence-link a {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .code-container {
        padding: 1rem;
    }
    
    textarea {
        min-height: 200px;
    }
}
