/* Regular Expression Tester Styles */

.regex-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Editor Section */
.editor-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.regex-input-container,
.text-input-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f5f7f9;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ddd;
}

.input-header label {
    font-weight: 500;
}

.flags-container {
    display: flex;
    gap: 1rem;
}

.flag-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.flag-option label {
    cursor: pointer;
    font-family: monospace;
}

.flag-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    font-family: sans-serif;
}

.flag-option:hover .flag-tooltip {
    opacity: 1;
    visibility: visible;
}

.input-with-buttons {
    display: flex;
    width: 100%;
}

.input-with-buttons input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: none;
    font-size: 1rem;
    font-family: monospace;
}

.input-with-buttons input:focus {
    outline: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.text-input-container textarea {
    width: 100%;
    min-height: 150px;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.text-input-container textarea:focus {
    outline: none;
}

.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    display: none;
}

.error-message.active {
    display: block;
    background-color: rgba(220, 53, 69, 0.1);
    border-top: 1px solid #dc3545;
}

/* Results Section */
.results-section {
    margin-bottom: 2rem;
}

.results-section h3 {
    margin-bottom: 1rem;
}

.results-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.highlighted-text {
    background-color: #f8f9fa;
    padding: 1rem;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.highlighted-text .placeholder {
    color: #999;
    font-style: italic;
    font-family: sans-serif;
}

.highlighted-text .match {
    background-color: rgba(58, 134, 255, 0.2);
    border-radius: 2px;
    padding: 2px 0;
    position: relative;
}

.highlighted-text .match:hover {
    background-color: rgba(58, 134, 255, 0.4);
}

.highlighted-text .match.group-1 {
    border-bottom: 2px solid rgba(131, 56, 236, 0.6);
}

.highlighted-text .match.group-2 {
    border-bottom: 2px solid rgba(255, 0, 110, 0.6);
}

.highlighted-text .match.group-3 {
    border-bottom: 2px solid rgba(32, 201, 151, 0.6);
}

.match-info {
    background-color: #f5f7f9;
    padding: 0.75rem 1rem;
    border-top: 1px solid #ddd;
}

.match-count {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.capture-groups {
    font-size: 0.9rem;
    color: #666;
}

.group-label {
    color: var(--primary-color);
    font-weight: 500;
    margin-right: 0.5rem;
}

/* Cheatsheet Section */
.cheatsheet-section {
    margin-top: 2rem;
}

.cheatsheet-section h3 {
    margin-bottom: 1rem;
}

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

.cheatsheet-column h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.cheatsheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cheatsheet-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.cheatsheet-table td {
    padding: 0.4rem 0.5rem;
}

.cheatsheet-table td:first-child {
    width: 80px;
    font-family: monospace;
    color: var(--primary-color);
    font-weight: 500;
}

.examples-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.example {
    background-color: #f5f7f9;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.example:hover {
    background-color: rgba(58, 134, 255, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Button Styles */
.btn-small {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
}

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

.btn-outline:hover {
    background-color: rgba(58, 134, 255, 0.1);
}

/* Code highlighting */
code {
    font-family: monospace;
    background-color: #f5f7f9;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

/* Related Tools Section */
.related-tools {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.related-tools h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #343541;
    font-size: 1.25rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 0.75rem;
}

.related-tools h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
}

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

.related-tool-card {
    padding: 1.25rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.related-tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.related-tool-card h4 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.related-tool-card p {
    flex-grow: 1;
    margin-bottom: 1.25rem;
    color: #4b5563;
    line-height: 1.5;
}

.btn-related {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s ease;
}

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

/* Responsive design */
@media (min-width: 768px) {
    .editor-section {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}