/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    text-align: center;
    padding: 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.header h1 i {
    color: #667eea;
    margin-right: 15px;
}

.header p {
    font-size: 1.1rem;
    color: #718096;
    font-weight: 400;
}

.blog-intro {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 10px;
    color: white;
}

.blog-intro p {
    color: white !important;
    font-size: 0.95rem;
    margin: 5px 0;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Section Styles */
section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px 25px;
    color: white;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.section-header i {
    margin-right: 10px;
}

/* Pattern Selection */
.pattern-selector {
    padding: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.pattern-dropdown {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pattern-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.3);
}

/* Pattern Details */
.details-section {
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pattern-info {
    padding: 25px;
}

.pattern-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.pattern-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
}

.pattern-badges {
    display: flex;
    gap: 10px;
}

.category-badge, .difficulty-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.category-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.difficulty-badge {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.pattern-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pattern-regex {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pattern-regex label {
    font-weight: 600;
    color: #4a5568;
    min-width: 140px;
}

.regex-code {
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #e53e3e;
    border: 2px solid #e2e8f0;
    flex: 1;
    min-width: 200px;
}

.copy-btn {
    padding: 10px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.pattern-description label,
.pattern-examples label {
    font-weight: 600;
    color: #4a5568;
    display: block;
    margin-bottom: 10px;
}

.pattern-description p {
    color: #718096;
    line-height: 1.6;
}

.examples-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.example-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.example-text {
    font-family: 'Courier New', monospace;
    color: #2d3748;
    margin-bottom: 8px;
}

.example-result {
    font-size: 0.9rem;
    color: #718096;
}

/* Tester Section */
.tester-container {
    padding: 25px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.regex-input-container {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.regex-input {
    flex: 1;
    min-width: 300px;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.regex-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.regex-validation {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.regex-validation.valid {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #68d391;
}

.regex-validation.invalid {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.regex-validation.warning {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #f6e05e;
}

.flags-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.flag-label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 5px;
}

.flag-checkbox {
    display: none;
}

.flag-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    background: white;
}

.flag-checkbox:checked + .flag-text {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.flag-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.flag-label:hover .flag-tooltip {
    opacity: 1;
}

.test-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
}

.test-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.clear-btn {
    background: linear-gradient(135deg, #fc8181, #f56565);
    color: white;
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 101, 101, 0.3);
}

.example-btn {
    background: linear-gradient(135deg, #fbb6ce, #ed64a6);
    color: white;
}

.example-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(237, 100, 166, 0.3);
}

/* Results Section */
.results-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.results-section h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.results-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item.full-width {
    grid-column: 1 / -1;
}

.result-item label {
    font-weight: 600;
    color: #4a5568;
}

.status-indicator {
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}

.status-success {
    background: #c6f6d5;
    color: #22543d;
}

.status-failure {
    background: #fed7d7;
    color: #742a2a;
}

.status-neutral {
    background: #e2e8f0;
    color: #4a5568;
}

.match-count {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

.match-results {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    max-height: 200px;
    overflow-y: auto;
}

.match-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f0fff4;
    border-left: 4px solid #48bb78;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
}

.match-info {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 5px;
}

.highlighted-text {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
    max-height: 200px;
    overflow-y: auto;
}

.highlight {
    background: linear-gradient(135deg, #fef5e7, #fed7aa);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    color: #c05621;
}

/* Methods Section */
.methods-container {
    padding: 25px;
}

.method-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.method-btn {
    padding: 10px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: 500;
    transition: all 0.3s ease;
}

.method-btn:hover, .method-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.method-output {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
}

.method-output pre {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Tools Section */
.tools-container {
    padding: 25px;
}

.tool-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #38b2ac, #319795);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(56, 178, 172, 0.3);
}

.tool-btn.active {
    background: linear-gradient(135deg, #2c7a7b, #285e61);
}

.tools-output {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    min-height: 100px;
}

/* Cheat Sheet Styles */
.cheatsheet-container {
    padding: 25px;
}

/* Navigation Tabs */
.cheat-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.cheat-tab {
    padding: 10px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #4a5568;
}

.cheat-tab:hover {
    background: #e2e8f0;
}

.cheat-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    border-bottom-color: transparent;
}

/* Tab Content */
.cheat-tab-content {
    display: none;
}

.cheat-tab-content.active {
    display: block;
}

.cheatsheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.cheat-category {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e2e8f0;
}

.cheat-category h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.cheat-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cheat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.cheat-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    cursor: pointer;
    transform: translateY(-1px);
}

.cheat-item code {
    background: #2d3748;
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

.cheat-item span {
    color: #4a5568;
    font-size: 0.95rem;
    flex: 1;
}

/* Pattern Examples */
.pattern-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.pattern-example {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.pattern-example:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.pattern-example h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.pattern-example code {
    display: block;
    background: #2d3748;
    color: #e2e8f0;
    padding: 12px 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    word-break: break-all;
}

.pattern-example code:hover {
    background: #4a5568;
    transform: scale(1.02);
}

.pattern-example p {
    color: #718096;
    font-size: 0.9rem;
    margin: 0;
}

/* Method Reference */
.method-reference {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.method-card {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.method-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.method-card h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
}

.method-card p {
    color: #4a5568;
    margin: 5px 0;
    font-size: 0.95rem;
}

.method-card > code {
    display: block;
    background: #2d3748;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    margin: 10px 0;
    font-size: 0.9rem;
}

.method-example {
    background: #1a202c;
    border-radius: 6px;
    padding: 10px;
    margin-top: 10px;
}

.method-example pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

/* Example Sections */
.example-sections {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.example-section {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e2e8f0;
}

.example-section h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.code-example {
    background: #1a202c;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
}

.code-example pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    background: white;
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    color: #4a5568;
}

.tips-list li code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #2d3748;
}

.tips-list a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.tips-list a:hover {
    text-decoration: underline;
}

/* Performance Testing Styles */
.benchmark-container {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.benchmark-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.benchmark-metric {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.benchmark-metric .metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.benchmark-metric .metric-label {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Pattern Builder Styles */
.builder-container {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.builder-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.builder-select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.builder-input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.builder-output {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    margin-top: 15px;
    font-size: 1.1rem;
}

.add-builder-btn {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.add-builder-btn:hover {
    background: #5a67d8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin: 20px 0;
    padding: 20px;
    text-align: center;
    color: #718096;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .pattern-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pattern-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .regex-input-container {
        flex-direction: column;
    }
    
    .regex-input {
        min-width: auto;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .results-content {
        grid-template-columns: 1fr;
    }
    
    .method-buttons {
        justify-content: center;
    }
    
    /* Cheat Sheet Responsive */
    .cheat-nav {
        justify-content: center;
    }
    
    .cheat-tab {
        flex: 1;
        text-align: center;
        min-width: 80px;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .cheatsheet-grid {
        grid-template-columns: 1fr;
    }
    
    .pattern-examples {
        grid-template-columns: 1fr;
    }
    
    .method-reference {
        grid-template-columns: 1fr;
    }
    
    .pattern-example code {
        font-size: 0.8rem;
        word-break: break-all;
    }
    
    .tool-buttons {
        justify-content: center;
    }
    
    .tool-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}
