/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --accent-color: #1e293b;
    --text-primary: #1e293b;
    --text-category: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    transition: background-color 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    /* Hide initially to prevent yellow flash */
}

body.ready {
    opacity: 1;
    /* Show once theme is applied */
}

#app {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Landing View */
#landing-view {
    max-width: 450px;
    width: 100%;
    margin: auto;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

#landing-view h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

#landing-view p {
    font-size: 1rem;
    font-weight: 400;
}

/* User View */
#user-view {
    display: none;
    width: 100%;
}

.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-category);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.link-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    font-size: 0.95rem;
    word-break: break-all;
    border: 1px solid transparent;

    /* Text Truncation (Max 1 line) */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--border-color);
}

/* Editor View */
#editor-view {
    display: none;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.editor-category-item {
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
}

.editor-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.editor-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.editor-link-tag {
    background: #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: move;
    transition: background 0.2s;
}

.editor-link-tag:hover {
    background: #cbd5e1;
}

.remove-tag,
.edit-tag {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0 2px;
}

.remove-tag {
    color: var(--error-color);
}

.edit-tag {
    color: var(--accent-color);
    margin-right: 4px;
}

/* Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

input {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    outline: none;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--accent-color);
}

button {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Color Swatches */
.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.color-swatch.active {
    border-color: var(--accent-color);
    transform: scale(1.15);
}

/* Floating Edit Button */
#edit-btn {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 999;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.btn-yellow {
    background: #facc15 !important;
    color: #1e293b !important;
}

.sortable-ghost {
    opacity: 0.4;
    background: #cbd5e1 !important;
}

/* Responsive (Mobile) */
@media screen and (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }

    .links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    #edit-btn {
        width: 42px;
        height: 42px;
        bottom: 20px;
        right: 20px;
        font-size: 1.2rem;
    }

    #landing-view {
        padding: 2rem 1.2rem;
    }

    #editor-view {
        padding: 1rem;
        width: 98%;
        margin: 1rem auto;
    }

    .editor-category-item {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }

    .editor-row {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    /* Keep theme selector and checkboxes in row */
    #editor-view>.editor-row,
    .editor-row:has(.color-swatch),
    .editor-row:has(input[type="checkbox"]) {
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .scary-timer {
        font-size: 1.8rem;
        /* Smaller for mobile */
        letter-spacing: 2px;
    }

    .editor-row input,
    .editor-row button {
        width: 100% !important;
        padding: 0.6rem 0.8rem !important;
        font-size: 0.9rem !important;
    }

    .color-swatch {
        width: 26px;
        height: 26px;
        border-width: 2px;
    }

    .input-group label {
        font-size: 0.8rem;
    }

    input {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
    }

    button {
        padding: 0.8rem 1.2rem !important;
        font-size: 0.9rem !important;
    }

    .category-title {
        font-size: 1.2rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

/* Self-Destruct Styles - Improved Readability & Mobile Fit */
.scary-timer {
    color: #ff4d00;
    /* Reduced glow for better readability, removed extreme multilayer shadows */
    text-shadow: 0 0 5px rgba(255, 77, 0, 0.5);
    font-size: 3rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    text-align: center;
    margin: 1.5rem 0;
    letter-spacing: 5px;
    /* Reduced form 12px to prevent overflow */
    /* Removed heavy flicker animation */
    animation: three-body-glow 2s infinite alternate;
}

@keyframes three-body-glow {
    from {
        opacity: 0.9;
    }

    to {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 77, 0, 0.8);
    }
}

/* Removed flicker animation keys to improve readability */


.exploded-state {
    position: fixed;
    inset: 0;
    background: #450a0a;
    color: #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
    padding: 2rem;
}

.glitch-text {
    font-size: 4rem;
    font-weight: 900;
    color: #ef4444;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
        -0.025em -0.05em 0 rgba(0, 255, 0, 0.75),
        0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    animation: glitch 500ms infinite;
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

.exploded-content p {
    font-size: 1.2rem;
    margin-top: 1rem;
    line-height: 1.6;
}


/* Guide Modal Specifics */
.guide-modal {
    padding: 2rem !important;
}

.guide-section {
    margin-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem;
}

.guide-section:last-child {
    border-bottom: none;
}

.guide-section h4 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guide-section p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
}

.guide-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: block;
    margin: 0 auto;
}
/* Styles for Collapsible Categories */
details.editor-category-item {
    border: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    padding: 0 !important; /* Reset padding override */
    overflow: hidden;
}

summary.category-summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none; /* Hide default triangle */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

summary.category-summary::-webkit-details-marker {
    display: none;
}

summary.category-summary::after {
    content: '';
    font-size: 0.8rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

details[open] summary.category-summary::after {
    transform: rotate(180deg);
}

.category-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #fff;
}


/* Language Toggle */
.lang-toggle-container {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.lang-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}
.lang-btn.active {
    color: var(--text-primary);
    text-decoration: underline;
}
.lang-btn:hover {
    color: var(--accent-color);
}
