/* style.css - Complete Master Version */
:root {
    --primary: #5c6bc0;
    --accent: #ff4757;
    --bg: #121212;
    --panel: #1e1e1e;
    --border: #333333;
    --text: #e0e0e0;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* --- Floating Fullscreen Button --- */
.floating-round-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(60, 60, 60, 0.8);
    backdrop-filter: blur(5px);
    color: white;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    transition: transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .floating-round-btn:hover {
        background: rgba(80, 80, 80, 0.9);
        border-color: #777;
    }
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

/* --- Wheel Panel (Left) --- */
.wheel-panel {
    flex: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: radial-gradient(circle, #1e1e1e 0%, #121212 100%);
    transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.wheel-panel.full-width {
    flex: 1;
    width: 100%;
}

.wheel-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1/1;
}

#pointer {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%) rotate(90deg);
    width: 0; height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 35px solid var(--accent);
    z-index: 10;
    filter: drop-shadow(-3px 0px 4px rgba(0,0,0,0.3));
}

#spinBtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #ffffff;
    border: 4px solid #f0f0f0; 
    color: #333;
    font-weight: 800;
    z-index: 5;
    transition: transform 0.1s, box-shadow 0.05s linear; 
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

#wheel-container text {
    paint-order: stroke;
    stroke: rgba(0,0,0,0.8);
    stroke-width: 3px;
    font-family: 'Inter', sans-serif;
}

/* --- Controls Panel (Right) --- */
.controls-panel {
    flex: 1;
    padding: 60px 40px 40px 40px;
    background: var(--panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.controls-panel.panel-hidden {
    display: none;
}

.hide-toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.hide-toggle-btn:hover {
    background: #333;
    border-color: var(--accent);
}

/* --- Show Button (Floating) --- */
.show-toggle-btn {
    display: none; /* Controlled by JS */
    position: fixed;
    top: 20px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2a2a;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 2000;
    display: none; /* Set to none initially */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Force centering for the icons */
.hide-toggle-btn svg, .show-toggle-btn svg {
    display: block;
}

/* --- Input Bar Styling --- */
.input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    position: relative;
}

#nameInputItem {
    flex: 1;
    background: #252525;
    border: 1px solid var(--border);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    font-size: 16px;
}

#addNameBtn {
    background: var(--primary);
    color: white;
    padding: 0 20px;
}

.clear-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: #888;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    transition: 0.2s;
}

.clear-circle-btn:hover { background: var(--accent); color: white; }

/* --- Dynamic Name List --- */
.names-list-container {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

.names-list-container::-webkit-scrollbar { width: 6px; }
.names-list-container::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }

.name-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    opacity: 0;
    animation: slideIn 0.4s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.delete-cross {
    color: #666;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.delete-cross:hover { color: var(--accent); }
.delete-cross:active { background: rgba(255, 71, 87, 0.2); }

/* --- Tabs & Buttons --- */
.tabs-nav { display: flex; margin-bottom: 20px; border-bottom: 2px solid #333; }
.tab-link { flex: 1; background: transparent; color: #888; padding: 12px; font-weight: bold; border: none; cursor: pointer; }
.tab-link.active { color: #fff; border-bottom: 2px solid var(--accent); }

.tabs-viewport { width: 100%; overflow: hidden; }
.tabs-slider { display: flex; width: 200%; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-pane { width: 50%; min-height: 450px; padding-top: 10px; }

.button-group { display: flex; gap: 10px; margin-bottom: 15px;}
button { cursor: pointer; border: none; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
button:hover { filter: brightness(1.2); }

#shuffleBtn { background: #b3020b; color: white; flex: 1; padding: 12px; }
#sortBtn { background: #2f3542; color: white; flex: 1; padding: 12px; }

/* --- Results --- */
.results-container {
    background: #161616;
    border: 1px solid #333;
    border-radius: 8px;
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 25px;
}

.result-row { padding: 10px 0; border-bottom: 1px solid #222; }

/* --- Templates (Bottom) --- */
.templates-outer-wrapper { width: 100%; max-width: 1200px; margin: 40px auto; padding: 0 20px; box-sizing: border-box;}
.template-toggle-wrapper { text-align: center; margin-bottom: 20px; }
.template-toggle-btn { background: #1a1a1a; border: 1px solid #333; color: #999; padding: 12px 30px; border-radius: 50px; cursor: pointer; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; padding: 20px; background: #0d0d0d; border-radius: 20px; }
.template-card { background: #161616; padding: 20px; border-radius: 15px; text-align: center; cursor: pointer; border: 1px solid #222; transition: 0.2s; }
.template-card:hover { border-color: var(--accent); transform: translateY(-5px); }
.thumb { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 10px auto; }
.yes-no { background: conic-gradient(#2ed573 0deg 180deg, #ff4757 180deg 360deg); }
.alphabet { background: conic-gradient(#ffa502, #1e90ff, #3742fa, #ff4757, #ffa502); }
.numbers { background: conic-gradient(#444 0deg 90deg, #222 90deg 180deg, #444 180deg 270deg, #222 270deg 360deg); }
.fast-food { background: conic-gradient(#f1c40f, #e67e22, #e74c3c, #c0392b, #f1c40f); }

/* --- Winner Modal --- */
.modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.9); z-index: 3000; justify-content: center; align-items: center; }
.modal-content { background: #252525; padding: 40px; border-radius: 24px; text-align: center; border: 1px solid #444; }
.danger-btn { background: var(--accent); color: white; padding: 12px 20px; margin-right: 10px; }
#closeModal { background: #444; color: white; padding: 12px 20px; }

/* --- Mobile Responsiveness --- */
@media (max-width: 800px) {
    .app-container { flex-direction: column; }
    .wheel-panel { order: 1; padding: 20px; }
    .controls-panel { order: 2; border-left: none; border-top: 1px solid #333; }
    .hide-toggle-btn {
        top: 10px;
        right: 10px;
    }
}

/* --- Global Click/Success Animations --- */
button:active, 
.template-card:active, 
.clear-circle-btn:active,
.delete-cross:active {
    transform: scale(0.94) !important;
    filter: brightness(0.8);
    transition: transform 0.05s linear;
}

#spinBtn:active {
    transform: translate(-50%, -50%) scale(0.9) !important;
}

.input-success {
    animation: successGlow 0.5s ease;
}

@keyframes successGlow {
    0% { border-color: var(--border); box-shadow: none; }
    50% { border-color: #2ed573; box-shadow: 0 0 10px rgba(46, 213, 115, 0.4); }
    100% { border-color: var(--border); box-shadow: none; }
}