@charset "UTF-8";

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--font-color);
    padding-top: 40px;
}

.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0px 20px 20px 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 20px;
}

.tool-title {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--font-color);
    margin-bottom: 10px;
}

.tool-subtitle {
    font-size: 1.2em;
    color: var(--font-color);
    opacity: 0.8;
    margin: 0;
}

.tool-content {
    background: var(--content-bg-color);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* Pattern Section */
.pattern-section {
    margin-bottom: 30px;
}

.pattern-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--font-color);
}

.pattern-input-container {
    display: flex;
    align-items: center;
    gap: 5px;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0;
    background: var(--alt-content-bg-color, #fff);
    transition: border-color 0.3s ease;
    overflow: hidden;
}

.pattern-input-container:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.pattern-delimiter {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #888;
    padding: 0 8px;
    background: transparent;
    height: 100%;
    display: flex;
    align-items: center;
}

#regexInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px 10px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    background: transparent;
    color: var(--font-color);
}

.flags-input {
    width: 80px;
    border: none;
    outline: none;
    padding: 15px 10px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    background: transparent;
    color: var(--font-color);
    text-align: center;
}

.pattern-help {
    margin-top: 10px;
    padding: 10px 15px;
    background: var(--alt-content-bg-color, #f8f9fa);
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
}

.pattern-help p {
    margin: 0;
    font-size: 14px;
    color: var(--font-color);
    opacity: 0.8;
}

/* Test Section */
.test-section {
    margin-bottom: 30px;
}

.test-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--font-color);
}

#testString {
    width: 100%;
    min-height: 120px;
    max-height: 300px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: var(--alt-content-bg-color, #fff);
    color: var(--font-color);
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#testString:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Results Container */
.results-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.explanation-section,
.matches-section {
    background: var(--alt-content-bg-color, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #eee;
}

.explanation-section h3,
.matches-section h3 {
    font-size: 1.1em;
    margin: 0 0 15px 0;
    color: var(--font-color);
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
}

.explanation-content,
.matches-content {
    min-height: 200px;
}

.placeholder-message {
    color: var(--font-color);
    opacity: 0.6;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.error-message {
    background: #dc3545;
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin: 20px 0;
}

/* Pattern Explanation Styles */
.pattern-display {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    margin-bottom: 20px;
    word-break: break-all;
}

.flags-explanation ul,
.pattern-explanation ul {
    margin: 10px 0;
    padding-left: 20px;
}

.flags-explanation li,
.pattern-explanation li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.breakdown-content code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
	color: #000;
}

/* Match Results Styles */
.matches-summary {
    background: #4CAF50;
    color: white;
    padding: 1px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.no-matches {
    text-align: center;
    padding: 30px;
    color: var(--font-color);
    opacity: 0.7;
}

.highlighted-text {
    margin-bottom: 20px;
}

.highlighted-text h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--font-color);
}

.highlight-container {
    background: var(--content-bg-color, #fff);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.highlight {
    background: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.matches-details h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: var(--font-color);
}

.match-item {
    background: var(--content-bg-color, #fff);
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.match-header {
    background: #f8f9fa;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

.match-number {
    font-weight: bold;
    color: #4CAF50;
}

.match-position {
    color: var(--font-color);
    opacity: 0.7;
    font-family: 'Courier New', monospace;
}

.match-content {
    padding: 15px;
}

.match-text {
    margin-bottom: 10px;
    font-size: 14px;
    word-break: break-word;
}

.match-groups {
    font-size: 14px;
}

.group-item {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Examples Section */
.examples-section {
    margin-top: 30px;
}

.examples-section h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--font-color);
}

.examples-categories {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.example-category {
    background: var(--alt-content-bg-color, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #ddd;
}

.example-category h4 {
    font-size: 1.1em;
    margin: 0 0 15px 0;
    color: var(--font-color);
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 8px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.example-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.example-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.example-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 123, 255, 0.2);
}

/* Add focus states for better accessibility */
.example-btn:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Category-specific button colors */
.example-category:nth-child(1) .example-btn { 
    background: #28a745; 
}
.example-category:nth-child(1) .example-btn:hover { 
    background: #1e7e34; 
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.example-category:nth-child(2) .example-btn { 
    background: #dc3545; 
}
.example-category:nth-child(2) .example-btn:hover { 
    background: #c82333; 
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.example-category:nth-child(3) .example-btn { 
    background: #ffc107; 
    color: #000; 
}
.example-category:nth-child(3) .example-btn:hover { 
    background: #e0a800; 
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.example-category:nth-child(4) .example-btn { 
    background: #17a2b8; 
}
.example-category:nth-child(4) .example-btn:hover { 
    background: #138496; 
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.example-category:nth-child(5) .example-btn { 
    background: #6f42c1; 
}
.example-category:nth-child(5) .example-btn:hover { 
    background: #5a32a3; 
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.3);
}

.example-category:nth-child(6) .example-btn { 
    background: #fd7e14; 
}
.example-category:nth-child(6) .example-btn:hover { 
    background: #e8630e; 
    box-shadow: 0 2px 8px rgba(253, 126, 20, 0.3);
}

.example-category:nth-child(7) .example-btn { 
    background: #6c757d; 
}
.example-category:nth-child(7) .example-btn:hover { 
    background: #5a6268; 
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

/* Pattern input focus enhancement */
#regexInput:focus {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Add a subtle loading animation for when examples are clicked */
.example-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.example-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dark Mode Adaptations */
body.dark-mode .tool-content {
    background: var(--content-bg-color);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

body.dark-mode .example-category {
    background: var(--alt-content-bg-color, #2d2d2d);
    border-color: #555;
}

body.dark-mode .example-category h4 {
    color: var(--font-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .results-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .examples-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-container {
        margin: 10px;
        padding: 15px;
    }
    
    .tool-content {
        padding: 20px;
    }
    
    .tool-title {
        font-size: 2em;
    }
    
    .examples-categories {
        gap: 20px;
    }
    
    .example-category {
        padding: 15px;
    }
    
    .examples-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 8px;
    }
    
    .pattern-input-container {
        flex-wrap: wrap;
    }
    
    .flags-input {
        width: 100%;
        text-align: left;
    }
    
    #regexInput {
        font-size: 14px;
    }
    
    .match-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .example-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .explanation-section,
    .matches-section {
        padding: 15px;
    }
    
    .highlight-container {
        padding: 10px;
        font-size: 13px;
    }
    
    .match-content {
        padding: 10px;
    }
    
    .examples-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .example-btn {
        padding: 8px 10px;
        font-size: 11px;
    }
}

/* Add smooth scrolling to the html element */
html {
    scroll-behavior: smooth;
}