:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.logo {
    text-align: center;
    color: var(--primary);
    margin-bottom: 20px;
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--dark);
}

.subtitle {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    display: none;
}

.error-message.show {
    display: block;
}

.result-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    display: none;
}

.result-message.show {
    display: block;
}

.result-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.result-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner circle {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

.navbar {
    background: white;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px var(--shadow);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.navbar-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: var(--secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--secondary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.accounts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.accounts-header h2 {
    font-size: 24px;
    color: white;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.account-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s;
}

.account-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-lg);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.account-email {
    font-weight: 600;
    color: var(--dark);
    word-break: break-all;
}

.account-date {
    font-size: 12px;
    color: var(--secondary);
    margin-top: 4px;
}

.account-field {
    margin-bottom: 12px;
}

.field-label {
    font-size: 12px;
    color: var(--secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.field-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-value input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.copy-btn {
    padding: 8px 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
    color: var(--secondary);
}

.copy-btn:hover {
    background: var(--border);
}

.totp-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.totp-code {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: white;
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.totp-timer {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.timer-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background: white;
    transition: width 1s linear;
}

.account-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.account-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 16px;
}

.add-accounts-container {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px var(--shadow);
}

.add-accounts-container h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.help-text {
    color: var(--secondary);
    margin-bottom: 16px;
}

.example-box {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.example-box code {
    font-size: 13px;
    color: var(--dark);
    line-height: 1.6;
}

@media (max-width: 1024px) {
    .accounts-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .navbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .navbar-stats {
        width: 100%;
        justify-content: space-around;
        gap: 12px;
    }
    
    .stat-item {
        flex: 1;
    }
    
    .container {
        padding: 16px;
    }
    
    .tabs {
        flex-direction: column;
        gap: 4px;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .accounts-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .accounts-header h2 {
        font-size: 20px;
        text-align: center;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .search-input {
        padding: 20px 24px;
        font-size: 20px;
        border-width: 4px;
        border-radius: 14px;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .account-card {
        padding: 16px;
    }
    
    .totp-code {
        font-size: 28px;
        letter-spacing: 2px;
    }
    
    .account-actions {
        flex-direction: column;
    }
    
    .account-actions .btn {
        width: 100%;
    }
    
    .login-card {
        padding: 24px;
    }
    
    .add-accounts-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .navbar-brand svg {
        width: 24px;
        height: 24px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .totp-code {
        font-size: 24px;
    }
    
    .field-value input {
        font-size: 13px;
    }
    
    .copy-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}
