@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-dark: #f8fafc;
    /* Light Gray/White - Slate 50 */
    --bg-card: #ffffff;
    /* Brighter White Cards */
    --primary: #1e40af;
    /* Blue 800 - Professional Blue */
    --primary-hover: #1d4ed8;
    /* Blue 700 */
    --accent: #b91c1c;
    /* Red 700 - Professional Red */
    --text-main: #0f172a;
    /* Slate 900 - Dark Text */
    --text-muted: #475569;
    /* Slate 600 - Muted Grey */
    --border: #e2e8f0;
    /* Slate 200 - Soft Border */
    --danger: #ef4444;
    --success: #22c55e;
    --glass: rgba(255, 255, 255, 0.95);
}

/* Global Input Refinements */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

body.high-contrast {
    --bg-dark: #ffffff;
    --bg-card: #f1f5f9;
    --text-main: #000000;
    --text-muted: #1e293b;
    --primary: #c2410c;
    --border: #64748b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    text-align: center;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-tab {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.input-field {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    width: 100%;
    transition: border-color 0.2s;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-unit {
    position: absolute;
    right: 1.25rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    pointer-events: none;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.input-field-with-unit {
    padding-right: 3.5rem !important;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Specific component styles */
.diagram-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
    touch-action: none;
    cursor: grab;
}

.diagram-container:active {
    cursor: grabbing;
}

#diagramSVG {
    transition: transform 0.05s ease-out;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.05);
    text-align: left;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

td {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 1rem;
    margin: 1rem 0;
}