/* static/style.css - CanMe Controller Rollout Design System */

/* CSS Variables for Color System */
:root {
    /* Light Mode Colors */
    --background: hsl(0 0% 100%);
    --foreground: hsl(222.2 84% 4.9%);

    --primary: hsl(222.2 47.4% 11.2%);
    --primary-foreground: hsl(210 40% 98%);

    --secondary: hsl(210 40% 96.1%);
    --secondary-foreground: hsl(222.2 47.4% 11.2%);

    --muted: hsl(210 40% 96.1%);
    --muted-foreground: hsl(215.4 16.3% 46.9%);

    --accent: hsl(210 40% 96.1%);
    --accent-foreground: hsl(222.2 47.4% 11.2%);

    --destructive: hsl(0 84.2% 60.2%);
    --destructive-foreground: hsl(210 40% 98%);

    --border: hsl(214.3 31.8% 91.4%);
    --input: hsl(214.3 31.8% 91.4%);
    --ring: hsl(222.2 84% 4.9%);

    /* Success colors */
    --success: hsl(142 76% 36%);
    --success-foreground: hsl(210 40% 98%);
    --success-bg: hsl(142 76% 95%);

    /* Warning colors */
    --warning: hsl(38 92% 50%);
    --warning-foreground: hsl(210 40% 98%);

    /* Info colors */
    --info: hsl(204 94% 94%);
    --info-border: hsl(204 94% 44%);
}

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

body {
    font-family: 'Comfortaa', sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    background-color: var(--background);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px hsla(222.2, 84%, 4.9%, 0.08);
    border: 1px solid var(--border);
    width: 100%;
}

.text-center {
    text-align: center;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Comfortaa', sans-serif;
    font-weight: 700;
    color: var(--foreground);
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.025em;
}

.decorative-title {
    font-family: 'MedievalSharp', cursive;
}

h2.success-title {
    color: var(--success);
}

h2.error-title {
    color: var(--destructive);
}

/* Form Elements */
label {
    font-weight: 600;
    color: var(--foreground);
    display: block;
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    text-align: left;
}

.note {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 12px;
    line-height: 1.5;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 14px;
    margin: 8px 0 20px 0;
    border: 2px solid var(--input);
    border-radius: 8px;
    font-family: 'Comfortaa', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background-color: var(--background);
    color: var(--foreground);
}

textarea {
    min-height: 220px;
    resize: vertical;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover {
    border-color: var(--muted-foreground);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--ring);
    outline: none;
    box-shadow: 0 0 0 3px hsla(222.2, 84%, 4.9%, 0.1);
}

/* Field Error Styles */
.input-error {
    border-color: var(--destructive) !important;
    background-color: hsl(0 84.2% 98%) !important;
}

.input-error:focus {
    border-color: var(--destructive) !important;
    box-shadow: 0 0 0 3px hsla(0, 84.2%, 60.2%, 0.15) !important;
}

.field-error {
    color: var(--destructive);
    font-size: 0.875rem;
    font-weight: 500;
    display: block;
    margin-top: -16px;
    margin-bottom: 16px;
    padding-left: 4px;
}

/* Buttons */
input[type="submit"], .download-btn, .back-btn, button[type="submit"] {
    font-family: 'Comfortaa', sans-serif;
    background-color: var(--primary);
    color: var(--primary-foreground);
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    margin: 20px 10px 10px 10px;
    box-shadow: 0 2px 8px hsla(222.2, 47.4%, 11.2%, 0.15);
}

input[type="submit"] {
    width: 100%;
    margin-top: 15px;
}

button[type="submit"] {
    width: 100%;
}

input[type="submit"]:hover,
input[type="submit"]:focus,
button[type="submit"]:hover,
button[type="submit"]:focus {
    background-color: hsl(222.2 47.4% 8%);
    box-shadow: 0 4px 12px hsla(222.2, 47.4%, 11.2%, 0.25);
    transform: translateY(-1px);
}

input[type="submit"]:active,
button[type="submit"]:active {
    transform: translateY(0);
}

.download-btn {
    background-color: var(--warning);
    color: var(--warning-foreground);
    width: 100%;
}

.download-btn:hover,
.download-btn:focus {
    background-color: hsl(38 92% 45%);
    box-shadow: 0 4px 12px hsla(38, 92%, 50%, 0.3);
    transform: translateY(-1px);
}

.download-btn:disabled {
    background-color: var(--muted);
    color: var(--muted-foreground);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.download-btn.orange {
    background-color: var(--warning);
    width: auto;
}

.download-btn.orange:hover {
    background-color: hsl(38 92% 45%);
}

.back-btn {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
    box-shadow: none;
}

.back-btn:hover,
.back-btn:focus {
    background-color: var(--muted);
    box-shadow: 0 2px 8px hsla(222.2, 47.4%, 11.2%, 0.1);
    transform: translateY(-1px);
}

/* Info Boxes */
.info {
    background-color: var(--info);
    border-left: 4px solid var(--info-border);
    padding: 20px;
    margin: 30px 0;
    border-radius: 8px;
    text-align: left;
    line-height: 1.6;
    color: var(--foreground);
}

.info strong {
    color: var(--info-border);
    font-weight: 700;
}

.success-info {
    background-color: var(--success-bg);
    border-left: 4px solid var(--success);
    padding: 20px;
    margin: 30px 0;
    border-radius: 8px;
    text-align: left;
    line-height: 1.6;
    color: var(--foreground);
}

.success-info strong {
    color: var(--success);
    font-weight: 700;
}

.error-info {
    background-color: hsl(0 84.2% 97%);
    border-left: 4px solid var(--destructive);
    padding: 20px;
    margin: 30px 0;
    border-radius: 8px;
    text-align: left;
    line-height: 1.6;
    color: var(--foreground);
}

.error-info strong {
    color: var(--destructive);
    font-weight: 700;
}

.error-msg {
    color: var(--destructive);
    margin-top: 10px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Download Form */
.download-form {
    margin: 30px 0;
    text-align: center;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background-color: var(--secondary);
    border-radius: 12px;
    overflow: hidden;
    margin: 30px 0;
    height: 48px;
    position: relative;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), hsl(222.2 47.4% 8%));
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-foreground);
    font-weight: 700;
    font-size: 1rem;
    font-family: 'Comfortaa', sans-serif;
}

.progress-text {
    margin-top: 20px;
    color: var(--muted-foreground);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 500;
}

/* Spinner */
.spinner {
    border: 4px solid var(--secondary);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.warning-text {
    color: var(--muted-foreground);
    margin-top: 30px;
    font-size: 0.9rem;
}

/* Credentials Display */
.credentials-container {
    margin-top: 30px;
    animation: fadeIn 0.3s ease-in;
}

.credentials-container h3 {
    color: var(--success);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.credentials-display {
    width: 100%;
    min-height: 200px;
    font-family: 'Courier New', Monaco, monospace;
    padding: 20px;
    border: 2px solid var(--success);
    border-radius: 8px;
    background-color: var(--success-bg);
    color: var(--foreground);
    resize: vertical;
    font-size: 0.9rem;
    line-height: 1.6;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px hsla(142, 76%, 36%, 0.1);
}

.credentials-display:focus {
    outline: none;
    border-color: var(--success);
    box-shadow: 0 0 0 3px hsla(142, 76%, 36%, 0.15);
}

.copy-btn {
    font-family: 'Comfortaa', sans-serif;
    margin-top: 15px;
    padding: 12px 24px;
    background-color: var(--success);
    color: var(--success-foreground);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px hsla(142, 76%, 36%, 0.2);
}

.copy-btn:hover {
    background-color: hsl(142 76% 32%);
    box-shadow: 0 4px 12px hsla(142, 76%, 36%, 0.3);
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background-color: hsl(142 76% 28%);
}

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

/* Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 20px 15px;
    }

    .container {
        padding: 25px;
    }

    h2 {
        font-size: 1.5rem;
    }

    input[type="submit"], .download-btn, .back-btn, button[type="submit"] {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .credentials-display {
        min-height: 150px;
        font-size: 0.85rem;
        padding: 15px;
    }
}