/* Text Analyzer Scoped Styles v1 */

#text-analyzer-toolkit {
    --bg-color: #F5F7FA;
    --panel-bg-color: #ffffff;
    --text-color: #343a40;
    --text-muted-color: #6c757d;
    --border-color: #dee2e6;
    --btn-bg: #f8f9fa;
    --btn-text: #495057;
    --btn-hover-bg: #fff;
    --btn-hover-border: #495057;
    --btn-hover-text: #212529;
    --brand-color: #007bff;
    --danger-color: #dc3545;
    --case-style-color: #6A5ACD;
    --shadow-light: rgba(0, 0, 0, 0.03);
    --shadow-medium: rgba(0, 0, 0, 0.07);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 20px 20px;
}

#text-analyzer-toolkit.dark-mode {
    --bg-color: #121212;
    --panel-bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-muted-color: #888;
    --border-color: #333;
    --btn-bg: #2a2a2a;
    --btn-text: #ccc;
    --btn-hover-bg: #333;
    --btn-hover-border: #007bff;
    --btn-hover-text: #fff;
    --brand-color: #0d8eff;
    --danger-color: #ff4d4d;
    --case-style-color: #9370DB;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-medium: rgba(255, 255, 255, 0.1);
}

#text-analyzer-toolkit *, 
#text-analyzer-toolkit *::before, 
#text-analyzer-toolkit *::after { box-sizing: border-box; margin: 0; padding: 0; }

#text-analyzer-toolkit main { display: flex; min-height: 85vh; border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); overflow: hidden; }
#text-analyzer-toolkit .left-panel { flex: 1 1 55%; position: relative; display: flex; flex-direction: column; background-color: var(--panel-bg-color); border-right: 1px solid var(--border-color); transition: background-color 0.3s ease, border-color 0.3s ease; }
#text-analyzer-toolkit .right-panel { flex: 1 1 45%; overflow-y: auto; padding: 40px; scroll-behavior: smooth; }

#text-analyzer-toolkit .header-controls { position: absolute; top: 20px; right: 20px; z-index: 20; display: flex; align-items: center; gap: 15px; }
#text-analyzer-toolkit .theme-switch-wrapper { display: flex; align-items: center; gap: 8px; font-size: 0.9em; color: var(--text-muted-color); }
#text-analyzer-toolkit .theme-switch { display: inline-block; height: 20px; position: relative; width: 40px; }
#text-analyzer-toolkit .theme-switch input { display: none; }
#text-analyzer-toolkit .slider { background-color: #ccc; bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0; transition: .4s; border-radius: 20px; }
#text-analyzer-toolkit .slider:before { background-color: #fff; bottom: 2px; content: ""; height: 16px; left: 2px; position: absolute; transition: .4s; width: 16px; border-radius: 50%; }
#text-analyzer-toolkit input:checked + .slider { background-color: var(--brand-color); }
#text-analyzer-toolkit input:checked + .slider:before { transform: translateX(20px); }

#text-analyzer-toolkit textarea {
    flex-grow: 1; width: 100%; padding: 40px; padding-top: 70px; border: none; outline: none; resize: none;
    font-size: 1.15em; line-height: 1.7; color: var(--text-color); background-color: transparent; transition: color 0.3s ease;
}
#text-analyzer-toolkit textarea::placeholder { color: var(--text-muted-color); }

#text-analyzer-toolkit .live-counters {
    position: absolute; top: 20px; left: 40px; font-size: 0.9em; color: var(--text-muted-color); font-weight: 500;
    z-index: 10; display: flex; gap: 20px; background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(4px);
    padding: 5px 10px; border-radius: 6px;
}
#text-analyzer-toolkit.dark-mode .live-counters { background-color: rgba(30, 30, 30, 0.7); }
#text-analyzer-toolkit .live-counters span { font-weight: 700; color: var(--text-color); }

#text-analyzer-toolkit .tools-container { display: flex; flex-direction: column; gap: 35px; }
#text-analyzer-toolkit .button-sections-wrapper { display: flex; flex-direction: column; gap: 28px; }
#text-analyzer-toolkit .tools-section .button-section-title { font-size: 1.1em; font-weight: 600; color: var(--text-color); margin-bottom: 16px; }
#text-analyzer-toolkit .action-group { display: flex; flex-wrap: wrap; gap: 12px; }

#text-analyzer-toolkit .action-buttons button {
    border: 1px solid var(--border-color); background-color: var(--btn-bg); color: var(--btn-text);
    padding: 9px 16px; border-radius: 8px; font-size: 0.9em; font-weight: 500; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s ease-in-out; white-space: nowrap; user-select: none;
}
#text-analyzer-toolkit .action-buttons button i { width: 16px; height: 16px; color: var(--text-muted-color); transition: color 0.2s ease-in-out; }
#text-analyzer-toolkit .action-buttons button:not(:disabled):hover { background-color: var(--btn-hover-bg); border-color: var(--btn-hover-border); color: var(--btn-hover-text); }
#text-analyzer-toolkit .action-buttons button:not(:disabled):hover i { color: var(--btn-hover-text); }
#text-analyzer-toolkit .action-buttons button.clear-btn { background-color: transparent; border-color: var(--danger-color); color: var(--danger-color); }
#text-analyzer-toolkit .action-buttons button.clear-btn i { color: var(--danger-color); }
#text-analyzer-toolkit .action-buttons button.clear-btn:hover { background-color: var(--danger-color); color: #fff; border-color: var(--danger-color); }
#text-analyzer-toolkit .action-buttons button.clear-btn:hover i { color: #fff; }
#text-analyzer-toolkit .action-buttons button.case-style-btn { border-color: var(--case-style-color); color: var(--case-style-color); background-color: transparent; }
#text-analyzer-toolkit .action-buttons button.case-style-btn i { color: var(--case-style-color); }
#text-analyzer-toolkit .action-buttons button.case-style-btn:hover { background-color: var(--case-style-color); border-color: var(--case-style-color); color: #fff; }
#text-analyzer-toolkit .action-buttons button.case-style-btn:hover i { color: #fff; }
#text-analyzer-toolkit .action-buttons button:disabled { opacity: 0.5; cursor: not-allowed; background-color: var(--btn-bg) !important; border-color: var(--border-color) !important; color: var(--text-muted-color) !important; }
#text-analyzer-toolkit .action-buttons button:disabled:hover i, #text-analyzer-toolkit .action-buttons button:disabled i { color: var(--text-muted-color) !important; }

#text-analyzer-toolkit .metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; }
#text-analyzer-toolkit .metrics-grid .section-title { grid-column: 1 / -1; font-size: 1.4em; font-weight: 600; color: var(--brand-color); margin-top: 15px; margin-bottom: 10px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
#text-analyzer-toolkit .metric-card {
    background-color: var(--panel-bg-color); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-light); text-align: center; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.3s ease; min-height: 140px;
}
#text-analyzer-toolkit .metric-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px var(--shadow-medium); }
#text-analyzer-toolkit .metric-icon i { color: var(--brand-color); width: 28px; height: 28px; }
#text-analyzer-toolkit .metric-value { font-size: 1.8em; font-weight: 600; color: var(--text-color); line-height: 1.2; word-break: break-all; transition: color 0.3s ease; }
#text-analyzer-toolkit .metric-value.small-text { font-size: 1.1em; line-height: 1.4; font-weight: 500; }
#text-analyzer-toolkit .metric-label { font-size: 0.85em; color: var(--text-muted-color); font-weight: 400; line-height: 1.4; transition: color 0.3s ease; }
#text-analyzer-toolkit .metric-card.wide-card { grid-column: span 2; min-height: 110px; }
#text-analyzer-toolkit .char-frequency-card, #text-analyzer-toolkit .keyword-density-card, #text-analyzer-toolkit .ngram-card, #text-analyzer-toolkit .duplicate-lines-card, #text-analyzer-toolkit .sentiment-card { text-align: left; align-items: flex-start; justify-content: flex-start; }
#text-analyzer-toolkit .char-frequency-card .metric-value, #text-analyzer-toolkit .keyword-density-card .metric-value, #text-analyzer-toolkit .ngram-card .metric-value, #text-analyzer-toolkit .duplicate-lines-card .metric-value { font-size: 0.95em; font-weight: 400; margin-top: 5px; line-height: 1.6; width: 100%; color: var(--btn-text); }
#text-analyzer-toolkit .char-frequency-card .metric-label, #text-analyzer-toolkit .keyword-density-card .metric-label, #text-analyzer-toolkit .ngram-card .metric-label, #text-analyzer-toolkit .duplicate-lines-card .metric-label, #text-analyzer-toolkit .sentiment-card .metric-label { margin-top: 0; font-size: 1em; font-weight: 600; color: var(--text-color); }
#text-analyzer-toolkit .sentiment-card .metric-value { font-size: 1.6em; font-weight: 600; margin-top: 0; }
#text-analyzer-toolkit .sentiment-positive { color: #28a745; } #text-analyzer-toolkit .sentiment-neutral { color: #ffc107; } #text-analyzer-toolkit .sentiment-negative { color: #dc3545; }

#text-analyzer-toolkit .fr-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);
    display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; z-index: 1000;
}
#text-analyzer-toolkit .fr-modal-overlay.visible { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }
#text-analyzer-toolkit .fr-modal-content {
    background: var(--panel-bg-color); border-radius: 12px; padding: 25px 30px;
    width: 100%; max-width: 450px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(-20px); transition: transform 0.3s ease;
}
#text-analyzer-toolkit .fr-modal-overlay.visible .fr-modal-content { transform: translateY(0); }
#text-analyzer-toolkit .fr-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
#text-analyzer-toolkit .fr-modal-header h3 { font-size: 1.3em; color: var(--text-color); }
#text-analyzer-toolkit .fr-modal-close { background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--text-muted-color); padding: 5px; line-height: 1; border-radius: 50%; }
#text-analyzer-toolkit .fr-modal-close:hover { background-color: var(--btn-bg); }
#text-analyzer-toolkit .fr-modal-body .form-group { margin-bottom: 15px; }
#text-analyzer-toolkit .fr-modal-body label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9em; color: var(--text-muted-color); }
#text-analyzer-toolkit .fr-modal-body input[type="text"] { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 1em; background: var(--bg-color); color: var(--text-color); }
#text-analyzer-toolkit .fr-modal-options { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 20px; }
#text-analyzer-toolkit .fr-modal-footer { display: flex; gap: 10px; justify-content: flex-end; }
#text-analyzer-toolkit .fr-modal-footer button { flex-grow: 1; }

#text-analyzer-toolkit .toast-notification {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background-color: #28a745; color: white; padding: 12px 25px; border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); font-weight: 500; z-index: 2000;
    opacity: 0; visibility: hidden; transition: opacity 0.3s, transform 0.3s, bottom 0.3s;
}
#text-analyzer-toolkit .toast-notification.show { opacity: 1; visibility: visible; bottom: 50px; }
#text-analyzer-toolkit .toast-notification.error { background-color: var(--danger-color); }

@media (max-width: 1200px) { #text-analyzer-toolkit .left-panel { flex-basis: 50%; } #text-analyzer-toolkit .right-panel { flex-basis: 50%; padding: 30px; } }
@media (max-width: 992px) { #text-analyzer-toolkit { overflow: auto; } #text-analyzer-toolkit main { flex-direction: column; height: auto; min-height: 0; } #text-analyzer-toolkit .left-panel { flex-basis: auto; height: 60vh; border-right: none; border-bottom: 1px solid var(--border-color); } #text-analyzer-toolkit .right-panel { flex-basis: auto; overflow-y: visible; } #text-analyzer-toolkit textarea { padding-top: 60px;} #text-analyzer-toolkit .live-counters { left: 30px; } }
@media (max-width: 768px) { #text-analyzer-toolkit { margin: 10px; } #text-analyzer-toolkit .right-panel { padding: 25px; } #text-analyzer-toolkit .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } #text-analyzer-toolkit .metric-card.wide-card { grid-column: span 1; } }
@media (max-width: 480px) { #text-analyzer-toolkit .left-panel { height: 50vh; } #text-analyzer-toolkit .right-panel { padding: 20px; } #text-analyzer-toolkit .live-counters { font-size: 0.8em; gap: 15px; top: 15px; left: 20px; } #text-analyzer-toolkit textarea { padding: 20px; padding-top: 50px; font-size: 1em; } #text-analyzer-toolkit .action-group { flex-direction: column; align-items: stretch; } #text-analyzer-toolkit .action-buttons button { width: 100%; justify-content: center; } #text-analyzer-toolkit .metrics-grid { grid-template-columns: 1fr; } #text-analyzer-toolkit .metric-card.wide-card { grid-column: auto; } }