/* Scoped styles for the Regex Tester App */

:root {
    --rx-bg: rgba(17, 24, 39, 0.7);
    --rx-primary: #f59e0b;
    --rx-primary-hover: #d97706;
    --rx-border: rgba(255, 255, 255, 0.1);
    --rx-match-bg: rgba(245, 158, 11, 0.25);
    --rx-match-border: rgba(245, 158, 11, 0.6);
    --rx-group-bg: rgba(99, 102, 241, 0.2);
}

.app-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.main-card {
    background: var(--rx-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--rx-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    width: 100%;
    max-width: 1000px;
    overflow: hidden;
    min-height: 550px;
    margin-top: 2rem;
}

/* Common Section Styles */
.input-section,
.display-section {
    padding: 2.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Left Section */
.input-section {
    border-right: 1px solid var(--rx-border);
    justify-content: flex-start;
}

.brand {
    margin-bottom: 1.5rem;
}

.brand h1 {
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.brand p {
    color: #94a3b8;
    font-size: 1rem;
}

.input-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group > label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Regex Input Wrapper */
.regex-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--rx-border);
    border-radius: 12px;
    padding: 0 0.75rem;
    transition: all 0.3s ease;
}

.regex-input-wrapper:focus-within {
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.regex-delimiter {
    color: #64748b;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: 700;
    user-select: none;
}

.regex-input-wrapper input#regex-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.85rem 0.5rem;
    color: #fbbf24;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    outline: none;
}

.flags-field {
    width: 40px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--rx-border);
    padding: 0.85rem 0.4rem;
    color: #94a3b8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    outline: none;
    text-align: center;
}

.regex-error {
    color: #ef4444;
    font-size: 0.8rem;
    padding: 0.4rem 0;
}

/* Flag Toggle Buttons */
.flag-buttons {
    display: flex;
    gap: 0.5rem;
}

.flag-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--rx-border);
    background: rgba(15, 23, 42, 0.6);
    color: #64748b;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-btn:hover {
    border-color: var(--rx-primary);
    color: var(--rx-primary);
}

.flag-btn.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--rx-primary);
    color: var(--rx-primary);
}

/* Test String Textarea */
textarea#test-string {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--rx-border);
    border-radius: 12px;
    padding: 1rem;
    color: #f8fafc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    line-height: 1.6;
    transition: all 0.3s ease;
    flex: 1;
    min-height: 120px;
}

textarea#test-string:focus {
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Right Section */
.display-section {
    background: rgba(15, 23, 42, 0.3);
    position: relative;
    overflow-y: auto;
    justify-content: flex-start;
}

.placeholder {
    text-align: center;
    color: #94a3b8;
    margin: auto;
}

#result-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-header label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.match-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rx-primary);
    background: rgba(245, 158, 11, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

/* Highlighted Output */
.highlighted-output {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--rx-border);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    color: #f8fafc;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 80px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.highlighted-output mark {
    background: var(--rx-match-bg);
    border: 1px solid var(--rx-match-border);
    border-radius: 3px;
    color: #fbbf24;
    padding: 0 2px;
}

/* Match Details */
.match-details-header {
    margin-bottom: 0.5rem;
}

.match-details-header label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.match-details {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-entry {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--rx-border);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
}

.match-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.match-index {
    color: var(--rx-primary);
    font-weight: 700;
    font-size: 0.8rem;
}

.match-position {
    color: #64748b;
    font-size: 0.75rem;
}

.match-value {
    font-family: 'Courier New', Courier, monospace;
    color: #f8fafc;
    word-break: break-all;
}

.match-groups {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--rx-border);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.group-item {
    font-size: 0.8rem;
    color: #94a3b8;
}

.group-item span {
    color: #818cf8;
    font-family: 'Courier New', Courier, monospace;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .main-card {
        flex-direction: column;
        height: auto;
    }

    .input-section {
        border-right: none;
        border-bottom: 1px solid var(--rx-border);
        padding: 2rem;
    }

    .display-section {
        padding: 2rem;
        min-height: 350px;
    }

    .brand h1 {
        font-size: 1.8rem;
    }
}
