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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --danger-light: #fca5a5;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --gradient-start: #6366f1;
    --gradient-end: #8b5cf6;
    --very-weak-color: #ef4444;
    --weak-color: #f97316;
    --fair-color: #eab308;
    --strong-color: #22c55e;
    --very-strong-color: #10b981;
}

html {
    font-size: 16px;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
main {
    flex: 1;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

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

#passwordInput {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.25rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#passwordInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#passwordInput::placeholder {
    color: var(--text-muted);
}

.toggle-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toggle-btn:hover {
    opacity: 1;
}

/* Results Section */
.results-section {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* Entropy Display */
.entropy-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.entropy-score-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

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

.entropy-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.entropy-unit {
    color: var(--text-muted);
    font-size: 1rem;
}

.strength-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    background: var(--surface-light);
    color: var(--text-secondary);
    transition: all 0.3s;
}

.strength-badge.very-weak {
    background: rgba(239, 68, 68, 0.2);
    color: var(--very-weak-color);
}

.strength-badge.weak {
    background: rgba(249, 115, 22, 0.2);
    color: var(--weak-color);
}

.strength-badge.fair {
    background: rgba(234, 179, 8, 0.2);
    color: var(--fair-color);
}

.strength-badge.strong {
    background: rgba(34, 197, 94, 0.2);
    color: var(--strong-color);
}

.strength-badge.very-strong {
    background: rgba(16, 185, 129, 0.2);
    color: var(--very-strong-color);
}

/* Visual Representation - Entropy Bar */
.visual-representation {
    margin-bottom: 1.5rem;
}

.entropy-bar-container {
    position: relative;
}

.entropy-bar {
    height: 12px;
    background: var(--surface-light);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.entropy-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--entropy-width, 0%);
    background: var(--entropy-color, var(--surface-light));
    border-radius: 6px;
    transition: width 0.3s ease, background 0.3s ease;
}

.entropy-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.entropy-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Character Analysis */
.character-analysis {
    margin-bottom: 1.5rem;
}

.character-analysis h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.char-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.char-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.char-type .check-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.char-type.active {
    color: var(--text-primary);
}

.char-type.active .check-icon {
    background: var(--success-color);
    color: white;
}

.password-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Suggestions Section */
.suggestions-section {
    margin-bottom: 1.5rem;
}

.suggestions-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

#suggestionsList {
    list-style: none;
}

#suggestionsList li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

#suggestionsList li:last-child {
    border-bottom: none;
}

#suggestionsList li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--warning-color);
}

.no-suggestions {
    color: var(--success-color) !important;
}

.no-suggestions::before {
    content: '✓' !important;
    color: var(--success-color) !important;
}

/* Crack Time Section */
.crack-time-section {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 1rem;
}

.crack-time-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.crack-times {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.crack-time-item {
    text-align: center;
}

.attack-type {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.time-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Explanation Section */
.explanation-section {
    margin-bottom: 2rem;
}

.explanation-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.explanation-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.explanation-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.explanation-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
}

.explanation-card p:last-child {
    margin-bottom: 0;
}

.explanation-card ul {
    margin-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.explanation-card li {
    margin-bottom: 0.25rem;
}

.formula {
    background: var(--surface-light);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.125rem;
    color: var(--secondary-color);
    margin: 1rem 0;
}

.tips-list {
    margin-left: 1.25rem;
}

.tips-list li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Entropy Table */
.entropy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.entropy-table th,
.entropy-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.entropy-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entropy-table td {
    color: var(--text-secondary);
}

.strength-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.strength-indicator.very-weak {
    background: rgba(239, 68, 68, 0.2);
    color: var(--very-weak-color);
}

.strength-indicator.weak {
    background: rgba(249, 115, 22, 0.2);
    color: var(--weak-color);
}

.strength-indicator.fair {
    background: rgba(234, 179, 8, 0.2);
    color: var(--fair-color);
}

.strength-indicator.strong {
    background: rgba(34, 197, 94, 0.2);
    color: var(--strong-color);
}

.strength-indicator.very-strong {
    background: rgba(16, 185, 129, 0.2);
    color: var(--very-strong-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0 1rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Mobile Responsive Styles */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .entropy-display {
        flex-direction: column;
        align-items: flex-start;
    }

    .entropy-value {
        font-size: 2.5rem;
    }

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

    .password-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .crack-times {
        grid-template-columns: 1fr;
    }

    .entropy-labels {
        display: none;
    }

    .entropy-table {
        font-size: 0.75rem;
    }

    .entropy-table th,
    .entropy-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 400px) {
    #passwordInput {
        font-size: 1rem;
        padding: 0.875rem 3rem 0.875rem 1rem;
    }

    .entropy-value {
        font-size: 2rem;
    }

    .formula {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
