/* style.css */
:root {
    --primary-color: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --secondary-color: #a855f7;
    --background: #0f0f23;
    --surface: #1a1a2e;
    --surface-light: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a8a8b3;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1a1a3e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: var(--transition);
}

.screen.hidden {
    display: none;
}

/* Master Password Screen */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: block;
}

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

.auth-form {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 400px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
}

.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    padding-right: 100px;
}

.password-input button {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.password-input button:hover {
    color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
}

.generate-inline {
    right: 48px !important;
}

.demo-note {
    margin-top: 20px;
    padding: 12px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.demo-note i {
    color: var(--primary-color);
    margin-right: 8px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 2px solid var(--surface-light);
}

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

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
}

/* Main Application */
.app-header {
    background: var(--surface);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.header-left .logo i {
    font-size: 32px;
    margin-bottom: 0;
}

.header-left .logo h1 {
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.device-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-selector select {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--primary-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.device-selector:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.app-main {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

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

.search-container i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.toolbar-actions {
    display: flex;
    gap: 12px;
}

/* Password List */
.password-list {
    display: grid;
    gap: 16px;
}

.password-item {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
    border: 2px solid transparent;
}

.password-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.2);
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.password-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 4px;
}

.password-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.password-actions {
    display: flex;
    gap: 8px;
}

.password-notes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--surface-light);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--surface-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    color: var(--primary-light);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Password Strength */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    height: 100%;
    transition: var(--transition);
}

.strength-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Password Generator */
.generated-password {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.generated-password input {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.generator-options {
    margin-bottom: 24px;
}

.option-group {
    margin-bottom: 20px;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.option-group input[type="range"] {
    width: 100%;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast i {
    font-size: 20px;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--error);
}

.toast.warning i {
    color: var(--warning);
}

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

/* Built with */
.built-with {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.built-with a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.built-with a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .toolbar-actions button {
        flex: 1;
    }

    .password-header {
        flex-direction: column;
        gap: 12px;
    }

    .password-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    .generated-password {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 24px;
    }

    .logo i {
        font-size: 48px;
    }

    .logo h1 {
        font-size: 24px;
    }

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

    .modal-actions button {
        width: 100%;
    }
}