/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --background-color: #f3f4f6;
    --card-background: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

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

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

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Sections */
section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

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

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Breach Alerts */
.breach-alerts {
    border-left: 4px solid var(--warning-color);
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-alerts {
    color: var(--text-secondary);
    font-style: italic;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.alert-item:hover {
    background: #fde68a;
}

.alert-item.critical {
    background: #fee2e2;
}

.alert-item.critical:hover {
    background: #fecaca;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

.alert-action {
    color: var(--primary-color);
    font-weight: 500;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.stat-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

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

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Forms */
.add-account-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Data Types Grid */
.data-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--border-color);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-color);
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-box input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    min-width: 200px;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: white;
}

/* Accounts List */
.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Account Card */
.account-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.account-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.account-card.risk-high {
    border-left: 4px solid var(--danger-color);
}

.account-card.risk-medium {
    border-left: 4px solid var(--warning-color);
}

.account-card.risk-low {
    border-left: 4px solid var(--success-color);
}

.account-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.account-category {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.account-data-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.data-type-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.account-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.privacy-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.privacy-badge.public {
    background: #fee2e2;
    color: #b91c1c;
}

.privacy-badge.friends {
    background: #fef3c7;
    color: #b45309;
}

.privacy-badge.private {
    background: #d1fae5;
    color: #047857;
}

.privacy-badge.unknown {
    background: #e5e7eb;
    color: #4b5563;
}

.risk-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.risk-badge.high {
    background: #fee2e2;
    color: #b91c1c;
}

.risk-badge.medium {
    background: #fef3c7;
    color: #b45309;
}

.risk-badge.low {
    background: #d1fae5;
    color: #047857;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

#editAccountForm,
#breachDetails {
    padding: 1.5rem;
}

/* Hidden Class */
.hidden {
    display: none !important;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.powered-by {
    margin-bottom: 0.5rem;
}

.powered-by a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 500;
}

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

.copyright {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Breach Details */
.breach-info {
    padding: 1rem 0;
}

.breach-info h4 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.breach-info p {
    margin-bottom: 0.75rem;
}

.breach-info strong {
    color: var(--text-primary);
}

.breach-recommendations {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: var(--radius-md);
}

.breach-recommendations h5 {
    margin-bottom: 0.75rem;
    color: #92400e;
}

.breach-recommendations ul {
    list-style: none;
    padding: 0;
}

.breach-recommendations li {
    padding: 0.375rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.breach-recommendations li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: #b45309;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.9375rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

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

    .search-box input {
        min-width: auto;
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .account-card {
        flex-direction: column;
    }

    .account-meta {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
    }

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

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .data-types-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.75rem;
    }

    section {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .data-types-grid {
        grid-template-columns: 1fr;
    }

    .logo-section {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }
}

/* Print Styles */
@media print {
    .header,
    .add-account-section,
    .breach-alerts,
    .footer {
        display: none;
    }

    .account-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}
