:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --success-color: #00875A;
    --error-color: #DE350B;
    --warning-color: #FFAB00;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F4F5F7;
    --bg-tertiary: #FAFBFC;
    --border-color: #DFE1E6;
    --border-focus: #4C9AFF;
    --shadow-sm: 0 1px 1px rgba(9, 30, 66, 0.13);
    --shadow-md: 0 2px 8px rgba(9, 30, 66, 0.08);
    --shadow-lg: 0 8px 16px rgba(9, 30, 66, 0.08);
    --border-radius: 4px;
    --border-radius-lg: 8px;
    --transition-fast: 200ms;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.logo {
    color: var(--success-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.language-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

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

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

main {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 300ms ease-in;
}

.tab-content.active {
    display: block;
}

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

.validator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.validator-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-fast);
}

.validator-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.validator-card h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.test-input,
.regex-input,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all var(--transition-fast);
    margin-bottom: 0.75rem;
}

.test-input:focus,
.regex-input:focus,
select:focus,
.test-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.1);
}

.validation-result {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.5rem;
    min-height: 2rem;
}

.validation-result.valid {
    background: rgba(0, 135, 90, 0.1);
    color: var(--success-color);
}

.validation-result.invalid {
    background: rgba(222, 53, 11, 0.1);
    color: var(--error-color);
}

.pattern-display {
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    word-break: break-all;
    margin-top: 0.5rem;
}

.pattern-display code {
    color: var(--primary-color);
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    display: inline-block;
}

.password-strength {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 1rem 0;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 300ms ease;
    border-radius: var(--border-radius);
}

.strength-bar.weak {
    background: var(--error-color);
}

.strength-bar.medium {
    background: var(--warning-color);
}

.strength-bar.strong {
    background: #36B37E;
}

.strength-bar.very-strong {
    background: var(--success-color);
}

.password-requirements {
    list-style: none;
    font-size: 0.9rem;
}

.password-requirements li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.password-requirements li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: var(--error-color);
}

.password-requirements li.satisfied {
    color: var(--success-color);
}

.password-requirements li.satisfied::before {
    content: '✓';
    color: var(--success-color);
}

.card-type {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.custom-regex-container {
    max-width: 800px;
    margin: 0 auto;
}

.regex-input-section,
.test-section,
.regex-helper {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.regex-flags {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.regex-flags label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.test-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    margin-bottom: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

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

.regex-results {
    margin-top: 1rem;
}

.regex-results .success,
.regex-results .error {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.regex-results .success {
    background: rgba(0, 135, 90, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.regex-results .error {
    background: rgba(222, 53, 11, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.regex-results ul {
    list-style: none;
    margin-top: 0.5rem;
}

.regex-results li {
    padding: 0.25rem 0;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ref-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
}

.ref-item code {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    min-width: 3rem;
    text-align: center;
}

.ref-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.generator-container {
    max-width: 800px;
    margin: 0 auto;
}

.generator-options {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

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

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.option-group input[type="number"],
.option-group input[type="text"] {
    width: 100%;
    max-width: 300px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.generated-result {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.pattern-output {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.pattern-output code {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
    word-break: break-all;
}

.btn-copy {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

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

.test-generated {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.test-generated h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#test-generated-input {
    width: 100%;
    margin-bottom: 0.5rem;
}

#test-generated-result {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
}

#test-generated-result.valid {
    background: rgba(0, 135, 90, 0.1);
    color: var(--success-color);
}

#test-generated-result.invalid {
    background: rgba(222, 53, 11, 0.1);
    color: var(--error-color);
}

footer {
    text-align: center;
    padding: 2rem;
    color: white;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header,
    main {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .tabs {
        gap: 0.5rem;
    }
    
    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .validator-grid {
        grid-template-columns: 1fr;
    }
    
    .reference-grid {
        grid-template-columns: 1fr;
    }
}