/* --- 1. GLOBAL VARIABLES & RESET --- */
:root {
    --primary-blue: #005DFF;
    --dark-blue: #0047AB;
    --light-blue-bg: #D1F0FF;
    --header-blue-bg: #AEE6FF;
    --text-color: #111;
    --gradient-btn: linear-gradient(90deg, #ED71AD 0%, #7277F1 100%);
    --gradient-footer: linear-gradient(90deg, #005DFF 0%, #D1F0FF 100%);
    --font-main: 'Outfit', sans-serif;
    --container-width: 1200px;
    --side-padding: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
    overflow-x: hidden;
}

/* --- 2. HEADER --- */
header { width: 100%; padding-top: 20px; background: #fff; }

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--side-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}



.logo { font-weight: 600; font-size: 24px; color: var(--dark-blue); text-decoration: none; }

.btn-touch {
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 187px;
    height: 45px;
    border: 3px solid #A38EFF;
    border-radius: 25px;
    font-weight: 600;
    font-size: 24px;
    background: var(--gradient-btn);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.2s ease, opacity 0.2s;
}
.btn-touch:hover { opacity: 0.8; transform: scale(1.02); }

.divider-line {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    height: 1px;
    background-color: rgba(0,0,0,0.1);
    border-top: 0.5px solid rgba(0,0,0,0.2);
}

/* --- 3. MAIN CONTAINER --- */
main {
    flex: 1;
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 40px var(--side-padding);
    position: relative;
    animation: fadeIn 0.6s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- 4. PAGE 1: HOME (Card) --- */
.card {
    background-color: var(--light-blue-bg);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: block;
    color: inherit;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-icon { width: 20px; height: auto; }
.card h3 { font-size: 16px; font-weight: 600; }
.card p { font-size: 13px; line-height: 1.4; opacity: 0.8; }

/* --- 5. PAGE 2: SCRAPER --- */
.back-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #000;
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 25px;
    transition: opacity 0.2s;
}
.back-nav:hover { opacity: 0.7; }
.back-nav img { height: 14px; width: auto; }

.scraper-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.scraper-header h1 { font-size: 22px; font-weight: 600; }
.description { font-size: 14px; color: #555; max-width: 700px; margin-bottom: 40px; line-height: 1.5; }

.input-group label { display: block; font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.required { font-weight: 400; color: #aaa; font-size: 14px; }

.url-input-outer {
    width: 100%;
    max-width: 591px;
    height: 60px;
    background: #D1F0FF;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}
.url-input-inner {
    width: 100%;
    height: 34px;
    background: #AEE6FF;
    border-radius: 5px;
    border: none;
    outline: none;
    padding-left: 15px;
    font-family: var(--font-main);
    color: #000;
}

.btn-start {
    margin-top: 30px;
    width: 129px;
    height: 50px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.btn-start:hover { background-color: #0046c0; transform: scale(1.05); }
.btn-start:disabled { background-color: #ccc; cursor: not-allowed; transform: none; }

.error-msg {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 10px;
    display: none;
    font-weight: 500;
}

/* --- LOADER (FIXED) --- */
.loader {
    width: 50px;
    padding: 8px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #AEE6FF;
    --_m:
        conic-gradient(#0000 10%,#000),
        linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
            mask: var(--_m);
    -webkit-mask-composite: source-out;
            mask-composite: subtract;
    animation: l3 1s infinite linear;

    /* Centering Logic: Fixed positioning + Negative Margins */
    /* We do NOT use transform here because it conflicts with the spin animation */
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -25px;  /* Half of 50px width */
    margin-left: -25px; /* Half of 50px height */
    z-index: 9999;
    display: none;
}
@keyframes l3 {to{transform: rotate(1turn)}}

.loader-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9998;
    display: none;
}

/* --- 6. PAGE 3: OVERVIEW --- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 25px; }
.current-page { display: flex; align-items: center; gap: 8px; font-weight: 500; }

.page-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 20px; }

.toggle-switch {
    width: 182px;
    height: 35px;
    background-color: #D1F0FF;
    border-radius: 8px;
    display: flex;
    padding: 2px;
}
.toggle-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}
.toggle-option.active { background-color: #AEE6FF; }

/* TABLE & JSON */
.table-wrapper {
    background: var(--light-blue-bg);
    border-radius: 15px;
    overflow: hidden;
    min-height: 400px;
    position: relative;
}
.table-scroll-container { width: 100%; overflow-x: auto; }
.custom-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.custom-table thead { background: var(--header-blue-bg); height: 50px; }
.custom-table th { text-align: left; padding: 0 15px; font-weight: 500; font-size: 14px; color: #000; }
.custom-table td { padding: 15px; font-size: 14px; border-bottom: 1px solid rgba(0,0,0,0.05); vertical-align: middle; }
.table-thumb { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: #ddd; }

/* JSON VIEW */
#json-view {
    display: none;
    padding: 20px;
    width: 100%;
    height: 600px;
    overflow-y: auto;
    background: transparent;
    color: #000;
    font-family: monospace;
    font-size: 14px;
}
.json-actions {
    background: var(--header-blue-bg);
    height: 50px;
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding: 0 15px;
    gap: 10px;
}
.btn-action {
    padding: 6px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    background: #fff;
    color: #333;
    transition: 0.2s;
}
.btn-action:hover { background: #f0f0f0; }

/* --- 7. FOOTER --- */
footer {
    width: 100%; height: 50px;
    background: var(--gradient-footer);
    display: flex; justify-content: center; align-items: center;
    margin-top: auto;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #fff;
    font-size: 12px;
}
.socials {
    display: flex;
    align-items: center;
    gap: 15px;
}
.socials a { display: flex; align-items: center; text-decoration: none; }
.socials img {
    height: 18px;
    filter: brightness(0) invert(1);
    cursor: pointer;
    transition: opacity 0.2s;
    display: block;
}
.socials img:hover { opacity: 0.7; }

@media (max-width: 768px) {
    .nav-container { padding: 0 20px; }
    main { padding: 30px 20px; }
    .page-controls { flex-direction: column; align-items: flex-start; }
    .url-input-outer { width: 100%; }
}
