/* ============================================================
   UNIFIED STYLESHEET — Tenny Tech
   Combines: css/style.css (main), apps/DXF_to_EPANET/css/style.css,
   apps/geosheet/css/styles.css, and the inline <style> from todo.
   Organized by page / section.
   ============================================================ */

/* --------------------------------------
   GLOBAL RESET & VARIABLES
   -------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* main site (from /css/style.css) */
    --bg-dark: #0a0a0f;
    --bg-card: #14141f;
    --bg-card-hover: #1a1a2e;
    --accent: #6c5ce7;
    --accent2: #00cec9;
    --text: #f5f5f5;
    --text-muted: #a0a0b0;
    --border: rgba(255, 255, 255, 0.08);

    /* DXF converter (from apps/DXF_to_EPANET/css/style.css) */
    --primary: #2563EB;
    --primary-700: #1d4ed8;
    --ink: #ffffff;
    --paper: #F8FAFC;
    --surface: #0a0a0f;
    --muted: #64748b;
    --danger: #ef4444;
    --danger-soft: #fdf2ed;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);

    /* geosheet (from apps/geosheet/css/styles.css) */
    --white: #ffffff;
    --black: #000000;
    --gray: #8FA396;
    --container: 1100px;

    /* todo (inline) uses same accent, but we keep extra var if needed */
}

html {
    scroll-behavior: smooth;
}

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

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --------------------------------------
   MAIN SITE — navigation, hero, cards, etc.
   (originally /css/style.css)
   -------------------------------------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text);
}

.logo span {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--text);
}

.hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(0, 206, 201, 0.1) 0%, transparent 50%);
    z-index: -1;
}

.hero-content {
    max-width: 800px;
    padding: 0 2rem;
    animation: fadeInUp 1s ease forwards;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.cta-button {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--text);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
    transition: all 0.3s;
}

.cta-button:hover {
    transform: translateY(-3px);
}

.apps-section {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 3rem;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
}

.app-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.app-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.app-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.app-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.about-section {
    padding: 6rem 2rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    color: var(--text-muted);
    margin-top: 1rem;
}

.contact-section {
    padding: 6rem 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-section p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* main site responsive */
@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
    }
    .apps-grid {
        grid-template-columns: 1fr;
    }
}

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

/* --------------------------------------
   DXF → EPANET 2.2  (apps/DXF_to_EPANET/css/style.css)
   -------------------------------------- */
/* override / extend root for DXF page, but keep consistency */
.dxf-app body { /* not used directly, but we keep selectors */
}

/* DXF specific classes — these are used inside .app, .main, .sidebar etc. */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 400px;
    min-width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.map-wrap {
    flex: 1;
    position: relative;
    background: #dbeafe;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: .5rem;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

input[type="file"],
select,
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.95rem;
    background: #444444;
    color: var(--ink);
}

input:focus,
select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.field {
    margin-bottom: 0.85rem;
}

.field:last-child {
    margin-bottom: 0;
}

.row {
    display: flex;
    gap: 0.75rem;
}

.row .field {
    flex: 1;
}

.range-group {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.range-val {
    min-width: 4rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .25);
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
}

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

.pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    font-size: .8rem;
    color: var(--muted);
}

.log {
    background: #0b1220;
    color: #e2e8f0;
    border-radius: 10px;
    padding: .75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.8rem;
    min-height: 120px;
    white-space: pre-wrap;
    overflow: auto;
    line-height: 1.45;
}

.hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.stat {
    background: #444444;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem .7rem;
}

.stat .label {
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat .value {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

/* Searchable CRS dropdown */
.crs-wrap {
    position: relative;
}

.crs-input {
    width: 100%;
    padding: .6rem .7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: .95rem;
    background: #ef4444;
    color: var(--ink);
}

.crs-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.crs-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #000000;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
    z-index: 60;
    display: none;
}

.crs-group {
    padding: .35rem .5rem;
    font-size: .7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #000000;
    position: sticky;
    top: 0;
}

.crs-option {
    padding: .55rem .7rem;
    cursor: pointer;
    font-size: .9rem;
    border-bottom: 1px solid #ffffff;
    display: flex;
    justify-content: space-between;
    gap: .5rem;
}

.crs-option:hover,
.crs-option.active {
    background: #2563EB;
}

.crs-option code {
    font-size: .75rem;
    color: var(--muted);
    font-family: ui-monospace, monospace;
}

.crs-empty {
    padding: .7rem;
    color: var(--muted);
    font-size: .85rem;
}

/* DXF responsive */
@media (max-width: 960px) {
    .main {
        flex-direction: column;
    }
    .sidebar {
        width: auto;
        height: auto;
        max-height: 55vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .map-wrap {
        min-height: 320px;
    }
}

/* --------------------------------------
   GEOSHEET — Excel to KML (apps/geosheet/css/styles.css)
   -------------------------------------- */
/* geosheet uses Fraunces & Nunito Sans, but we keep Inter for consistency */
/* we keep their classes, but adjust to match main palette */
.geosheet-body { /* not used, but keep selectors */ }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--paper);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    color: #3d4f45;
    margin-bottom: 1.5rem;
}

.hero-img {
    border-radius: 12px;
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

.section {
    padding: 3rem 0;
}

.tool-card {
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 6px 30px rgba(28, 43, 36, 0.06);
}

.tool-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
}

.tool-body {
    padding: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--gray);
    border-radius: var(--radius);
    padding: 2.5rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(47, 107, 79, 0.03);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(47, 107, 79, 0.06);
}

.upload-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.muted {
    color: var(--gray);
    font-size: 0.9rem;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
}

.sheet-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.panel .hint {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 340px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th,
td {
    padding: 0.5rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead tr:first-child th {
    background: var(--black);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 5;
}

thead tr:nth-child(2) th {
    background: #f8faf8;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 33px;
    z-index: 5;
}

tbody tr:hover {
    background: #f8faf8;
}

select.col-map {
    width: 100%;
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.map-wrap {
    position: relative;
    height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    background: #d8ddd3;
}

#mapPreview {
    width: 100%;
    height: 100%;
}

.map-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(243, 247, 240, 0.95);
    text-align: center;
    padding: 1rem;
}

.map-overlay.hidden {
    display: none !important;
}

.warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger);
    background: var(--danger-soft);
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.warning.hidden {
    display: none !important;
}

.export {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.export textarea {
    width: 100%;
    height: 220px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    resize: vertical;
    margin-top: 0.75rem;
}

.export-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.status-ok {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.status-bad {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.hidden {
    display: none !important;
}

/* geosheet responsive */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------
   TODO LIST — (inline styles from apps/todo/index.html)
   -------------------------------------- */
/* we keep the inline styles but moved here for uniformity */
/* already uses root variables, but we ensure .todo-container etc. */

.todo-container {
    width: 100%;
    max-width: 550px;
    margin-top: 3rem;
}

.todo-container h1 {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.todo-container input[type="text"] {
    flex: 1;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
    outline: none;
}

.todo-container input[type="text"]:focus {
    border-color: var(--accent);
}

.add-btn {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.3s;
}

.filter-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    animation: slideIn 0.3s ease;
    transition: all 0.3s;
}

.todo-item:hover {
    border-color: rgba(108, 92, 231, 0.3);
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.todo-item.completed .checkbox {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-color: transparent;
}

.checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.todo-item.completed .checkbox::after {
    opacity: 1;
}

.todo-text {
    flex: 1;
    font-size: 1rem;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.delete-btn:hover {
    color: var(--danger);
    background: rgba(255, 99, 72, 0.1);
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.95rem;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* back-link (used on sub-pages) */
.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

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

/* --------------------------------------
   UTILITY / OVERRIDES
   -------------------------------------- */
/* ensure DXF header uses brand colors */
.brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
}

.brand span {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
}

/* make all buttons consistent */
.btn:not(.btn-primary):not(.btn-secondary) {
    /* fallback */
}

/* keep leaflet map styles intact (already loaded via CDN) */