/* DBMS Key Analyzer */

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

:root {
    --bg-primary: #0a0f1e;
    --bg-secondary: #0f172a;
    --bg-panel: #111827;
    --bg-input: #0d1321;
    --border: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-cyan: #22d3ee;
    --accent-green: #34d399;
    --accent-purple: #a78bfa;
    --accent-yellow: #facc15;
    --glow-cyan: rgba(34, 211, 238, 0.15);
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

.glow-orb {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(120px);
    animation: orbFloat 12s ease-in-out infinite alternate;
}

.glow-orb-1 {
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.1), transparent 70%);
}

.glow-orb-2 {
    bottom: -80px;
    left: -80px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.08), transparent 70%);
    animation-delay: -6s;
}

@keyframes orbFloat {
    to {
        transform: translate(30px, 20px) scale(1.1);
    }
}

.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.header-icon {
    flex-shrink: 0;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.4));
}

.app-header h1 {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-sub {
    margin-top: 2px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.panel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
}

.panel-dot:nth-child(1) {
    background: #ef4444;
    opacity: 0.7;
}

.panel-dot:nth-child(2) {
    background: #facc15;
    opacity: 0.7;
}

.panel-dot:nth-child(3) {
    background: #34d399;
    opacity: 0.7;
}

.panel-title {
    margin-left: auto;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.panel-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--glow-cyan);
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
}

input[type="text"],
textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.7rem 0.85rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--glow-cyan);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.input-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.input-hint code {
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    font-size: 0.68rem;
}

#compute-btn {
    width: 100%;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(52, 211, 153, 0.15));
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
}

#compute-btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent-cyan);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(52, 211, 153, 0.25));
    box-shadow: 0 0 20px var(--glow-cyan);
}

#compute-btn:active {
    transform: translateY(0);
}

#compute-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-text[hidden],
.btn-loader[hidden] {
    display: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(34, 211, 238, 0.3);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.error-msg {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    font-size: 0.78rem;
    line-height: 1.5;
}

.output-placeholder {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

.result-section {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.result-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    font-size: 0.7rem;
    font-weight: 700;
}

.keys-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.key-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    animation: popIn 0.3s ease-out backwards;
}

.key-badge.candidate {
    border: 1px solid rgba(34, 211, 238, 0.35);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(34, 211, 238, 0.05));
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.1);
}

.key-badge.superkey {
    border: 1px solid rgba(167, 139, 250, 0.25);
    background: rgba(167, 139, 250, 0.08);
    color: var(--accent-purple);
}

.key-badge .brace {
    opacity: 0.5;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.superkey-message,
.empty-state {
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    line-height: 1.5;
}

.superkey-message {
    border: 1px solid rgba(250, 204, 21, 0.2);
    background: rgba(250, 204, 21, 0.08);
    color: var(--accent-yellow);
}

.empty-state {
    border: 1px dashed var(--border);
    color: var(--text-muted);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.info-item {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}

.info-label {
    margin-bottom: 0.2rem;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-green);
}

.app-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

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