/* ========================================
   Local Storage Manager — Clean Dark Theme
   ======================================== */
:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --green: #22C55E;
    --bg: #0F0F14;
    --bg-card: rgba(18, 18, 24, 0.85);
    --bg-hover: #1A1A24;
    --bg-input: rgba(10, 10, 16, 0.7);
    --border: rgba(99, 102, 241, 0.12);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text: #F1F1F4;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Actions Bar */
.actions-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    position: relative;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.65rem 0.5rem 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    outline: none;
    transition: border-color var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
}

.meta-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border);
    padding: 0.25rem 0.55rem;
    border-radius: 100px;
    font-weight: 500;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818CF8);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
}

/* Table */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.entries-table {
    width: 100%;
    border-collapse: collapse;
}

.entries-table th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.04);
}

.entries-table td {
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    vertical-align: top;
}

.entries-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

.col-key {
    width: 25%;
}

.col-value {
    width: 45%;
}

.col-size {
    width: 10%;
}

.col-actions {
    width: 20%;
}

.key-cell {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--primary);
    word-break: break-all;
}

.value-cell {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
    max-height: 80px;
    overflow: hidden;
}

.value-cell.expanded {
    max-height: none;
}

.size-cell {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.actions-cell {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow);
}

.modal h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.form-group {
    margin-bottom: 0.65rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    outline: none;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .app {
        padding: 1rem 0.85rem 3rem;
    }

    .actions-bar {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .col-size {
        display: none;
    }

    .entries-table th:nth-child(3),
    .entries-table td:nth-child(3) {
        display: none;
    }
}