/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

/* Base Styles */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.shield-icon {
    width: 40px;
    height: 40px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.tagline {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    gap: 8px;
    background: var(--surface);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    position: relative;
}

.tab svg {
    width: 22px;
    height: 22px;
}

.tab:hover {
    background: var(--background);
    color: var(--text-primary);
}

.tab.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

.alert-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Main Content */
.content {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Section Header */
.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.input-group input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

/* Password Input */
.password-input-wrapper {
    flex: 1;
    position: relative;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn svg {
    width: 18px;
    height: 18px;
}

.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading span {
    display: none;
}

.btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.btn.loading .spinner {
    display: block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Security Notice */
.security-notice {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.security-notice svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.security-notice strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.security-notice p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Password Strength */
.password-strength {
    margin-bottom: 24px;
}

.strength-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

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

.strength-text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Monitored Emails */
.monitored-emails {
    margin-bottom: 24px;
}

.monitored-emails h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.helper-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.monitored-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.monitored-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.monitored-item .email {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monitored-item svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.monitored-item .remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.monitored-item .remove-btn:hover {
    color: var(--danger-color);
    background: var(--danger-light);
}

.monitored-item .remove-btn svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

/* Results Container */
.results-container {
    margin-top: 24px;
}

.result-card {
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-card.safe {
    background: var(--success-light);
    border-left: 4px solid var(--success-color);
}

.result-card.warning {
    background: var(--warning-light);
    border-left: 4px solid var(--warning-color);
}

.result-card.danger {
    background: var(--danger-light);
    border-left: 4px solid var(--danger-color);
}

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

.result-header svg {
    width: 28px;
    height: 28px;
}

.result-card.safe .result-header svg {
    color: var(--success-color);
}

.result-card.warning .result-header svg {
    color: var(--warning-color);
}

.result-card.danger .result-header svg {
    color: var(--danger-color);
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-details {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.result-details p {
    margin-bottom: 8px;
}

/* Breach List */
.breach-list {
    margin-top: 16px;
}

.breach-item {
    background: rgba(255,255,255,0.5);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.breach-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breach-item .date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.breach-item .data-types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.breach-item .tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Alert Settings */
.alert-settings {
    background: var(--background);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.setting-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 13px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Select */
select {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

select:focus {
    border-color: var(--primary-color);
}

/* Alerts List */
.alerts-list h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.alert-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.alert-item.unread {
    background: var(--warning-light);
    border-left: 4px solid var(--warning-color);
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-icon svg {
    width: 20px;
    height: 20px;
}

.alert-item.unread .alert-icon {
    background: var(--warning-color);
    color: white;
}

.alert-item:not(.unread) .alert-icon {
    background: var(--border-color);
    color: var(--text-secondary);
}

.alert-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

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

/* Guides Grid */
.guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.guide-card {
    background: var(--background);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.guide-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.guide-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.guide-card-header .icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--primary-light);
}

.guide-card-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.guide-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.guide-card .difficulty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
}

.guide-card .difficulty.easy {
    background: var(--success-light);
    color: var(--success-color);
}

.guide-card .difficulty.medium {
    background: var(--warning-light);
    color: var(--warning-color);
}

.guide-card .difficulty.hard {
    background: var(--danger-light);
    color: var(--danger-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    padding: 32px;
    position: relative;
    margin: 40px 0;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--background);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger-color);
}

#modal-body h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#modal-body h2 .icon {
    font-size: 2rem;
}

#modal-body .steps {
    margin-top: 24px;
}

#modal-body .step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

#modal-body .step-number {
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

#modal-body .step-content h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

#modal-body .step-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#modal-body .step-content a {
    color: var(--primary-color);
    text-decoration: none;
}

#modal-body .step-content a:hover {
    text-decoration: underline;
}

#modal-body .tips {
    margin-top: 24px;
    padding: 16px;
    background: var(--warning-light);
    border-radius: var(--radius);
}

#modal-body .tips h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--warning-color);
}

#modal-body .tips ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

#modal-body .tips li {
    margin-bottom: 4px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.powered-by {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.powered-by a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.powered-by a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }

    .header {
        padding: 24px 16px;
    }

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

    .tabs {
        padding: 6px;
        gap: 4px;
    }

    .tab {
        padding: 10px 8px;
        min-width: 70px;
        font-size: 0.75rem;
    }

    .tab svg {
        width: 20px;
        height: 20px;
    }

    .tab span:not(.alert-badge) {
        display: none;
    }

    .content {
        padding: 16px;
    }

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

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .security-notice {
        flex-direction: column;
        text-align: center;
    }

    .security-notice svg {
        margin: 0 auto;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .guides-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
        margin: 20px 0;
    }

    #modal-body h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 12px;
    }

    .logo {
        flex-direction: column;
        gap: 8px;
    }

    .shield-icon {
        width: 36px;
        height: 36px;
    }

    .monitored-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .monitored-item .remove-btn {
        align-self: flex-end;
    }

    .alert-item {
        flex-direction: column;
    }

    .alert-icon {
        width: 32px;
        height: 32px;
    }

    .footer-content {
        gap: 4px;
    }
}

/* Print Styles */
@media print {
    .tabs, .btn, .modal, .toggle-switch, select {
        display: none !important;
    }

    .tab-content {
        display: block !important;
    }

    .app-container {
        max-width: none;
    }
}
