/* ===== CSS Variables ===== */
:root {
    --color-primary: #701a75;
    /* Fuchsia */
    --color-primary-light: #a21caf;
    --color-primary-dark: #4a044e;
    --color-accent: #fef08a;
    /* Yellow */

    --color-bg: #000000;
    --color-bg-card: rgba(255, 255, 255, 0.08);
    /* Minimalist Glass */
    --color-bg-input: rgba(255, 255, 255, 0.05);
    --color-bg-hover: rgba(255, 255, 255, 0.12);

    --color-text: #e5e7eb;
    /* grayish white */
    --color-text-muted: #9ca3af;
    --color-text-subtle: #6b7280;

    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-focus: rgba(254, 240, 138, 0.5);
    /* Yellow focus */

    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.1);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(112, 26, 117, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    /* Robin's cards use 1rem/16px */
    --radius-xl: 16px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(to right, rgb(112, 26, 117), rgb(0, 0, 0));
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Background Pattern ===== */
.background-pattern {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(112, 26, 117, 0.15) 0%, transparent 80%);
    pointer-events: none;
}

/* ===== Container ===== */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    text-align: left;
    /* Alignment on Robin's projects is left-ish in the main container but centered logo? Actually projects list is left. I'll stick to centered for this tool but clean. */
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease-out;
}

.header-badge {
    display: inline-block;
    color: var(--color-accent);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.header h1 {
    font-size: 30px;
    font-weight: 400;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.header h1 a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.header h1 a:hover {
    opacity: 0.8;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    max-width: 100%;
}

/* ===== Card ===== */
/* ===== Card ===== */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    /* Robin's padding 24px */
    box-shadow: none;
    /* Minimalist */
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out 0.1s both;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
    background-color: var(--color-bg-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.card::before {
    display: none;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--color-bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    z-index: 100;
    border-radius: var(--radius-xl);
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ===== Form Steps ===== */
#processingForm {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.form-step {
    margin-bottom: 1.75rem;
    animation: fadeInUp 0.4s ease-out;
}

.form-step.hidden {
    display: none;
}

.form-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.95rem;
    /* slightly smaller, more elegant */
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--color-text-muted);
    /* muted label for cleaner look */
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    /* Solid fuchsia */
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    /* Squircle */
    flex-shrink: 0;
}

/* ===== Form Inputs ===== */
.form-select,
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.form-select:hover,
.form-input:hover {
    background-color: var(--color-bg-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.form-select:focus,
.form-input:focus {
    background-color: var(--color-bg-hover);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(254, 240, 138, 0.1);
}

.form-select option {
    background: var(--color-bg);
    color: var(--color-text);
    padding: 0.5rem;
}

/* ===== Date Inputs ===== */
.date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.date-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.form-input::placeholder {
    color: var(--color-text-subtle);
}

/* ===== Submit Button ===== */
.btn-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--color-primary);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: none;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background: var(--color-primary-light);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-submit.hidden {
    display: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

/* ===== Results Section ===== */
.results {
    animation: fadeInUp 0.5s ease-out;
}

.results.hidden {
    display: none;
}

.results-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.results-subtitle {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ===== Result Cards ===== */
.results-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.result-card.primary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(254, 240, 138, 0.2);
    /* yellow border hint */
}

.result-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.result-value {
    font-size: 1.75rem;
    font-weight: 400;
    /* Regular weight like Robin's h1 */
    color: var(--color-accent);
    /* Yellow accent for the data */
    line-height: 1.2;
}

.result-card.primary .result-value {
    font-size: 2.25rem;
    color: var(--color-accent);
}

/* ===== Last Updated ===== */
.last-updated {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.update-icon {
    width: 14px;
    height: 14px;
    stroke: var(--color-text-subtle);
}

/* ===== Reset Button ===== */
.btn-reset {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    border-color: rgba(255, 255, 255, 0.2);
}

.reset-icon {
    width: 18px;
    height: 18px;
}

/* ===== Settings Accordion (for bookmarked URLs) ===== */
.settings-accordion {
    margin-top: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 400;
    font-family: inherit;
    background: transparent;
    color: var(--color-text-muted);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
}

.settings-toggle-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-icon {
    width: 16px;
    height: 16px;
}

.chevron-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-normal);
}

.settings-accordion.expanded .chevron-icon {
    transform: rotate(180deg);
}

.settings-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-accordion.expanded .settings-content {
    max-height: 1000px;
}

.settings-content-inner {
    padding: 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Bookmark/Share Button ===== */
.btn-bookmark {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    color: var(--color-text-subtle);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-bookmark:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-muted);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-bookmark.copied {
    color: var(--color-success);
    border-color: var(--color-success);
}

.bookmark-icon {
    width: 16px;
    height: 16px;
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    padding-top: 2.5rem;
    text-align: center;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.footer p {
    font-size: 0.85rem;
    color: var(--color-text-subtle);
    max-width: 500px;
    margin: 0 auto;
}

.footer a {
    color: var(--color-accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.footer a:hover {
    opacity: 0.8;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.8rem !important;
    opacity: 0.7;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem 2rem;
    }

    .card {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .form-label {
        font-size: 0.95rem;
    }

    .date-inputs {
        grid-template-columns: 1fr;
    }

    .result-card.primary .result-value {
        font-size: 1.6rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.form-select:focus-visible,
.form-input:focus-visible,
.btn-submit:focus-visible,
.btn-reset:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}