/* =========================================
   VARIABLES & THEME
   ========================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --input-bg: #f8fafc;
    --radius: 12px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-light: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    line-height: 1.5;
}

/* =========================================
   ICONS & UI ELEMENTS
   ========================================= */
.icon { 
    width: 24px; 
    height: 24px; 
    stroke: currentColor; 
    stroke-width: 2; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    fill: none; 
}

/* =========================================
   TOPBAR NAVIGATION
   ========================================= */
.topbar { 
    background: var(--bg-card); 
    border-bottom: 1px solid var(--border); 
    height: 64px; 
    padding: 0 1.5rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 50; 
}

.brand { 
    font-weight: 800; 
    font-size: 1.25rem; 
    color: var(--primary); 
    text-decoration: none; 
}

.nav-right { 
    display: flex; 
    gap: 0.5rem; 
    align-items: center; 
    position: relative; 
}

.btn-icon { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    color: var(--text-main); 
    padding: 8px; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: background 0.2s; 
}

.btn-icon:hover { 
    background: var(--border); 
}

/* =========================================
   AUTH POPOVER
   ========================================= */
.auth-popover { 
    position: absolute; 
    top: 60px; 
    right: 0; 
    width: 320px; 
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    box-shadow: var(--shadow); 
    border-radius: var(--radius); 
    padding: 1.5rem; 
    display: none; 
    z-index: 100; 
}

.auth-popover.active { 
    display: block; 
    animation: slideDown 0.2s ease-out; 
}

@keyframes slideDown { 
    from { opacity: 0; transform: translateY(-10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.auth-popover::before { 
    content: ''; 
    position: absolute; 
    top: -6px; 
    right: 50px; 
    width: 12px; 
    height: 12px; 
    background: var(--bg-card); 
    border-top: 1px solid var(--border); 
    border-left: 1px solid var(--border); 
    transform: rotate(45deg); 
}

.tabs { 
    display: flex; 
    margin-bottom: 1.5rem; 
    border-bottom: 1px solid var(--border); 
}

.tab { 
    flex: 1; 
    background: none; 
    border: none; 
    padding: 0.75rem; 
    font-weight: 600; 
    color: var(--text-light); 
    cursor: pointer; 
    border-bottom: 2px solid transparent; 
}

.tab.active { 
    color: var(--primary); 
    border-bottom-color: var(--primary); 
}

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-group { 
    margin-bottom: 1rem; 
}

.label { 
    display: block; 
    font-size: 0.85rem; 
    font-weight: 600; 
    margin-bottom: 0.4rem; 
}

.input, .select, .textarea { 
    width: 100%; 
    padding: 0.6rem 0.8rem; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    background: var(--input-bg); 
    color: var(--text-main); 
    box-sizing: border-box; 
    font-size: 0.95rem; 
}

.textarea { 
    min-height: 100px; 
    resize: vertical; 
}

.btn-primary { 
    width: 100%; 
    background: var(--primary); 
    color: white; 
    border: none; 
    padding: 0.75rem; 
    border-radius: 8px; 
    font-weight: 600; 
    cursor: pointer; 
}

.btn-primary:hover { 
    background: var(--primary-dark); 
}

.link-text { 
    font-size: 0.85rem; 
    color: var(--primary); 
    cursor: pointer; 
    text-decoration: underline; 
}

.btn-group { 
    display: flex; 
    gap: 1rem; 
    width: 100%; 
}

.btn-wide { flex: 2; }
.btn-small { flex: 1; }

.btn-no-underline {
    text-decoration: none !important;
}

/* =========================================
   MAIN LAYOUT
   ========================================= */
.container { 
    max-width: 650px; 
    margin: 3rem auto; 
    padding: 0 1rem; 
}

.card { 
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    padding: 2rem; 
    box-shadow: var(--shadow); 
}

.hero { 
    text-align: center; 
    margin-bottom: 2rem; 
}

.hero h1 { 
    margin: 0; 
    font-size: 2rem; 
    letter-spacing: -1px; 
}

/* =========================================
   MESSAGES & TOAST
   ========================================= */
.msg { font-size: 0.85rem; margin-top: 0.5rem; display: block; }
.msg.error { color: #ef4444; }
.msg.success { color: #10b981; }

.toast { 
    visibility: hidden; 
    min-width: 250px; 
    background-color: #333; 
    color: #fff; 
    text-align: center; 
    border-radius: 8px; 
    padding: 16px; 
    position: fixed; 
    z-index: 999; 
    right: 30px; 
    bottom: 30px; 
    font-size: 17px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    opacity: 0; 
    transition: opacity 0.5s, bottom 0.5s; 
}

.toast.show { 
    visibility: visible; 
    opacity: 1; 
    bottom: 50px; 
}

/* =========================================
   DATA VIEW PAGE (Centered Card)
   ========================================= */
.view-body {
    background: var(--bg-body);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center; /* Vertically Center Card */
}

.view-container { 
    width: 100%; 
    max-width: 800px; 
    padding: 1rem; 
    box-sizing: border-box; 
    display: flex; 
    justify-content: center; 
}

.view-card { 
    background: var(--bg-card); 
    width: 100%; 
    border-radius: var(--radius); 
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15); 
    border: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    max-height: 80vh; 
}

.view-header { 
    background: var(--input-bg); 
    padding: 1rem 1.5rem; 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0; 
}

.view-title { 
    margin: 0; 
    font-size: 1rem; 
    color: var(--text-light); 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

/* Centered View Content */
.view-content { 
    padding: 2rem; 
    font-family: 'Courier New', Courier, monospace; 
    white-space: pre-wrap; 
    word-break: break-word; 
    color: var(--text-main); 
    line-height: 1.6; 
    font-size: 1rem; 
    overflow-y: auto; 
    scrollbar-width: thin;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 300px;
}

.icon-btn { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    color: var(--text-light); 
    padding: 8px; 
    border-radius: 8px; 
    transition: all 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.icon-btn:hover { 
    background: rgba(0,0,0,0.05); 
    color: var(--primary); 
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.copied { color: #10b981; }
.icon-btn.copied svg { transform: scale(1.1); }

/* =========================================
   DELETE CONFIRM MODAL
   ========================================= */
.confirm-modal { 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(2px); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 2000; 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.2s; 
}

.confirm-modal.active { 
    opacity: 1; 
    pointer-events: auto; 
}

.confirm-box { 
    background: var(--bg-card); 
    padding: 1.5rem; 
    border-radius: var(--radius); 
    width: 100%; 
    max-width: 320px; 
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); 
    text-align: center; 
    border: 1px solid var(--border); 
}

.confirm-title { 
    font-weight: 700; 
    font-size: 1.1rem; 
    margin-bottom: 0.5rem; 
}

.confirm-text { 
    color: var(--text-light); 
    font-size: 0.9rem; 
    margin-bottom: 1.5rem; 
}

.confirm-actions { 
    display: flex; 
    gap: 0.5rem; 
    justify-content: center; 
}

.btn-danger { 
    background: #ef4444; 
    color: white; 
    border: none; 
    padding: 0.5rem 1rem; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
}

.btn-cancel { 
    background: var(--input-bg); 
    color: var(--text-main); 
    border: 1px solid var(--border); 
    padding: 0.5rem 1rem; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
}

/* =========================================
   RESULT PANEL & GUEST VIEW
   ========================================= */
.result-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 0; 
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    background: var(--input-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.result-body {
    padding: 2.5rem 0;
    min-height: 220px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-link-display {
    font-size: 1.25rem; 
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    word-break: break-all;
    line-height: 1.4;
    text-align: center;
    padding: 0 1rem;
}

/* --- UPDATED: CENTERED INNER PANEL --- */
.result-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    
    /* Dimensions */
    width: 70%; 
    margin: 0 auto;
    padding: 5% 1.5rem;
    
    /* Center Text & Content */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    overflow-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap; 
    max-height: 300px;
    overflow-y: auto;
}

.icon-btn-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.icon-btn-sm svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}
