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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --border-radius: 8px;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.hidden { display: none !important; }

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
}

#login-screen .container {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

#login-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--bg-card);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-icon {
    background: transparent;
    padding: 0.5rem;
    font-size: 1.2rem;
}

.error {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 1.5rem;
}

/* Vault Screen */
#vault-screen header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-card);
}

#vault-screen header h1 {
    font-size: 1.5rem;
    color: var(--accent);
}

#vault-screen nav {
    display: flex;
    gap: 0.5rem;
}

#vault-screen nav button {
    padding: 0.5rem 1rem;
}

#vault-screen main {
    flex: 1;
    padding: 1rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    font-size: 1.1rem;
}

/* Entries List */
#entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-card {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.entry-card:hover {
    background: var(--bg-card);
}

.entry-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.entry-info {
    flex: 1;
}

.entry-name {
    font-weight: 500;
}

.entry-username {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.entry-actions {
    display: flex;
    gap: 0.5rem;
}

.copy-btn {
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.copy-btn:hover {
    background: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

.password-field {
    display: flex;
    gap: 0.5rem;
}

.password-field input {
    flex: 1;
}

.password-strength {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s, background 0.3s;
}

.strength-fill.weak { width: 25%; background: var(--danger); }
.strength-fill.fair { width: 50%; background: var(--warning); }
.strength-fill.good { width: 75%; background: #8bc34a; }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 50px;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    animation: slideIn 0.3s;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Help modal */
.help-content {
    max-width: 400px;
}

.help-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--accent);
}

.help-content h3:first-of-type {
    margin-top: 0;
}

.help-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.help-content ul li {
    margin-bottom: 0.25rem;
}

.help-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.shortcuts-table {
    width: 100%;
    font-size: 0.9rem;
}

.shortcuts-table td {
    padding: 0.25rem 0;
}

.shortcuts-table td:first-child {
    width: 150px;
}

kbd {
    background: var(--bg-primary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
    #vault-screen header {
        flex-direction: column;
        gap: 1rem;
    }

    #vault-screen main {
        padding: 1rem;
    }

    .modal-content {
        margin: 1rem;
    }
}
