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

:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --purple-color: #9C27B0;
    --background-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #64B5F6;
    --success-color: #66BB6A;
    --warning-color: #FFCA28;
    --danger-color: #EF5350;
    --purple-color: #BA68C8;
    --background-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E3E3E3;
    --text-secondary: #B3B3B3;
    --border-color: #2C2C2C;
    --shadow: 0 2px 10px rgba(0,0,0,0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 80px;
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.app-logo {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.lang-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.35rem 0.7rem;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
}

.lang-btn.active:hover {
    background: white;
}

#theme-toggle { white-space: nowrap; padding: 0.35rem 0.6rem; font-size: 0.85rem; border-radius: 16px; }

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    overflow-x: hidden;
}
 
[data-theme="dark"] body {
    background-color: var(--background-color);
    color: var(--text-color);
}

.app-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.app-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.generator-container,
.audit-container,
.monitor-container,
.faq-container {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.generator-container h2,
.audit-container h2,
.monitor-container h2,
.faq-container h2 {
    margin-bottom: 2rem;
    color: var(--primary-color);
    font-size: 1.8rem;
    text-align: center;
}
 
.section-intro {
    color: var(--text-secondary);
    text-align: center;
    margin: -1rem 0 1.5rem 0;
}

.toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar .primary-btn,
.toolbar .secondary-btn {
    width: auto;
    padding: 0.7rem 1rem;
}

.password-display {
    position: relative;
    margin-bottom: 2rem;
}

#generated-password {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding-right: 100px;
    box-sizing: border-box;
}

.password-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
}

.password-actions button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-actions button:hover {
    background: #1976D2;
    transform: scale(1.1);
}

.generator-options {
    margin-bottom: 2rem;
}
 
.generator-options .checkbox-group {
    margin-top: 0.75rem;
}

.group-title {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.option-group {
    margin-bottom: 1.5rem;
}

.option-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

#length-value {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    min-width: 30px;
    text-align: center;
}

#password-length {
    width: 100%;
    margin-top: 0.5rem;
    accent-color: var(--primary-color);
}

.checkbox-group {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.checkbox-group label:hover {
    background: rgba(33, 150, 243, 0.1);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.secondary-btn:hover {
    background: #5a6268;
}
 
.tertiary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.tertiary-btn:hover {
    color: var(--text-color);
    border-color: #cfcfcf;
}

/* Improve header toggle contrast over gradient */
.app-header #theme-toggle {
    color: #fff;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.12);
}

.app-header #theme-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.password-strength {
    margin-top: 1rem;
}

.strength-meter {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: var(--transition);
    border-radius: 4px;
}

.strength-bar.weak {
    background: var(--danger-color);
    width: 25%;
}

.strength-bar.fair {
    background: var(--warning-color);
    width: 50%;
}

.strength-bar.good {
    background: var(--primary-color);
    width: 75%;
}

.strength-bar.strong {
    background: var(--success-color);
    width: 100%;
}

.audit-input textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.audit-results,
.breach-results {
    margin-top: 2rem;
}
 
.audit-input .primary-btn {
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
}

.result-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-item.weak {
    border-left-color: var(--danger-color);
    background: rgba(244, 67, 54, 0.05);
}

.result-item.fair {
    border-left-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.05);
}

.result-item.good {
    border-left-color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.result-item.strong {
    border-left-color: var(--success-color);
    background: rgba(76, 175, 80, 0.05);
}

.result-item h4 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.result-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
 
.item-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.monitor-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
 
.monitor-input > *:not(button) {
    flex: 1;
}

#email-check {
    flex: 1;
    min-width: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    box-sizing: border-box;
}

#check-breaches {
    white-space: nowrap;
    flex-shrink: 0;
}

.saved-emails {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.saved-emails h3,
.shared-passwords h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.email-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.email-item span {
    font-family: 'Courier New', monospace;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

.remove-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    white-space: nowrap;
}

.remove-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

 

.faq-items {
    display: grid;
    gap: 1rem;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-color);
}

.faq-question {
    width: 100%;
    background: var(--surface-color);
    border: none;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.faq-question:hover {
    background: #f8f9fa;
}

.faq-question[aria-expanded="true"] {
    background: rgba(33, 150, 243, 0.1);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: var(--transition);
    flex-shrink: 0;
    margin-left: 1rem;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer:not([hidden]) {
    padding: 1rem;
    max-height: 200px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.8rem;
    min-width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

footer {
    background: #222;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    opacity: 0.85;
}

.footer-links a:hover { opacity: 1; text-decoration: underline; }

.footer-sep { opacity: 0.5; }

.footer-meta {
    opacity: 0.8;
}

.toast {
    position: fixed;
    top: 100px;
    right: 1rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transform: translateX(400px);
    transition: var(--transition);
    z-index: 1001;
    font-weight: 500;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

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

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

/* Audit summary styles */
.audit-summary { 
    margin-bottom: 2rem; 
    padding: 1rem; 
    background: #f8f9fa; 
    border-radius: 8px; 
}

.summary-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    gap: 1rem; 
    margin: 1rem 0; 
}

.summary-item { 
    text-align: center; 
    padding: 1rem; 
    background: white; 
    border-radius: 8px; 
    border-left: 4px solid #ddd; 
}

.summary-item.weak { border-left-color: #F44336; }
.summary-item.fair { border-left-color: #FFC107; }
.summary-item.good { border-left-color: #2196F3; }
.summary-item.strong { border-left-color: #4CAF50; }

.summary-item strong { 
    display: block; 
    font-size: 1.5rem; 
    margin-bottom: 0.5rem; 
}

.overall-score { 
    text-align: center; 
    margin-top: 1rem; 
}

.password-preview { 
    font-family: monospace; 
    background: #eee; 
    padding: 0.5rem; 
    border-radius: 4px; 
    margin: 0.5rem 0; 
}

.issues, .recommendations { 
    margin-top: 0.5rem; 
}

.issues ul, .recommendations ul { 
    margin-left: 1rem; 
}

/* Modal styles */
.password-modal {
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: rgba(0,0,0,0.8); 
    z-index: 10000;
    display: flex; 
    align-items: center; 
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white; 
    border-radius: 12px; 
    max-width: 500px; 
    width: 100%;
    max-height: 90vh; 
    overflow-y: auto;
    margin: 1rem;
    max-height: calc(100vh - 2rem);
}

.modal-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 1rem; 
    border-bottom: 1px solid #eee;
}

.modal-close {
    background: none; 
    border: none; 
    font-size: 1.5rem; 
    cursor: pointer;
    padding: 0.5rem;
}

.modal-body { 
    padding: 1rem; 
}

.modal-footer { 
    padding: 1rem; 
    text-align: center; 
    border-top: 1px solid #eee; 
}

 

.security-notice {
    background: #f8f9fa; 
    padding: 1rem; 
    border-radius: 6px; 
    margin-top: 1rem;
}

.security-notice ul { 
    margin-left: 1rem; 
}

/* Responsive design */
@media (min-width: 768px) {
    .monitor-input {
        flex-direction: row;
    }
    
    .checkbox-group {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .email-item {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .app-main {
        padding: 2rem;
    }
    
    .generator-container,
    .audit-container,
    .monitor-container,
    .faq-container {
        padding: 3rem;
    }
    
    .checkbox-group {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .header-content h1 { font-size: 1.5rem; }
    .app-logo { height: 40px; }
    .language-switcher { width: 100%; justify-content: flex-end; gap: 0.2rem; }
    .lang-btn { padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 10px; }
    #theme-toggle { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
    #theme-toggle .btn-label { display: none; }
}

@media (max-width: 380px) {
    .header-content { gap: 0.3rem; }
    .header-content h1 { font-size: 1.5rem; }
    .app-logo { height: 40px; }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .monitor-input {
        flex-direction: column;
    }
    
    .password-display {
        position: relative;
    }
    
    #generated-password {
        padding-right: 10px;
        margin-bottom: 1rem;
    }
    
    .password-actions {
        position: static;
        transform: none;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .email-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .nav-item {
        min-width: 50px;
        font-size: 0.7rem;
    }
    
    .nav-item i {
        font-size: 1rem;
    }
    
    .toast {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }
    
    .generator-container,
    .audit-container,
    .monitor-container,
    .faq-container {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
}

/* Additional fixes for container overflow */
.app-main {
    overflow-x: hidden;
}

.generator-container,
.audit-container,
.monitor-container,
.faq-container {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for long text in buttons */
.primary-btn,
.secondary-btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fix for long URLs in share links */
.share-link input {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* Fix for email items with long addresses */
.email-item span {
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Ensure all interactive elements are properly sized */
button, input, select, textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Fix for FAQ items */
.faq-question {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for audit results */
.result-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for breach items */
.breach-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
