* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.panel h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: 'Monaco', 'Courier New', monospace;
}

.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.options {
    margin: 20px 0;
}

.inline-group {
    margin-bottom: 14px;
}

.mode-hint {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f6f8ff;
    border: 1px solid #d8e0ff;
    color: #49557a;
    font-size: 0.92rem;
    line-height: 1.5;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.icon {
    font-size: 1.2em;
}

.status-message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.browser-status-card {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #dbe5f0;
    border-radius: 12px;
}

.browser-status-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.browser-phase {
    font-weight: 700;
    color: #334155;
}

.browser-phase-meta {
    color: #64748b;
    font-size: 0.9rem;
    font-family: 'Monaco', 'Courier New', monospace;
}

.browser-progress-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.browser-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%);
    transition: width 0.25s ease;
}

@keyframes indeterminate-sweep {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.browser-progress-bar.indeterminate {
    width: 100% !important;
    background: linear-gradient(90deg, #38bdf8 30%, #a5f3fc 50%, #38bdf8 70%);
    background-size: 200% 100%;
    animation: indeterminate-sweep 1.6s linear infinite;
    transition: none;
}

.browser-status-detail {
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.5;
}

.result-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

.result-content {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    padding-top: 72px;
    padding-right: 36px;
    min-height: 320px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: box-shadow 0.2s ease;
}

.copy-button {
    position: absolute;
    top: 16px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.6);
    border-radius: 999px;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(6px);
    z-index: 5;
}

.copy-button:hover:not(:disabled) {
    background: rgba(243, 244, 246, 0.95);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.15);
    transform: translateY(-1px);
}

.copy-button:active:not(:disabled) {
    transform: translateY(0);
}

.copy-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.copy-button:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.copy-button.copied {
    background: rgba(220, 252, 231, 0.95);
    border-color: rgba(74, 222, 128, 0.6);
    color: #166534;
    box-shadow: 0 6px 16px rgba(22, 101, 52, 0.18);
}

.copy-button.copied .copy-icon::before,
.copy-button.copied .copy-icon::after {
    border-color: #16a34a;
    background: rgba(255, 255, 255, 0.9);
}

.copy-icon {
    position: relative;
    width: 16px;
    height: 16px;
}

.copy-icon::before,
.copy-icon::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 2px solid #4b5563;
    background: rgba(255, 255, 255, 0.95);
}

.copy-icon::before {
    top: 2px;
    left: 0;
    opacity: 0.8;
}

.copy-icon::after {
    top: -2px;
    left: 4px;
}

.copy-label {
    letter-spacing: 0.02em;
}

.placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* Stats display */
.stats-info {
    margin-top: 15px;
    padding: 15px;
    background: #e8f4fd;
    border-radius: 8px;
    border: 1px solid #b8daff;
    display: none;
}

.stats-info h3 {
    color: #0066cc;
    margin-bottom: 10px;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    font-size: 0.9em;
}

.stat-item {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 0; /* Allow shrinking */
}

.stat-label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 2px;
    white-space: nowrap;
}

.stat-value {
    font-weight: 600;
    color: #0066cc;
    font-family: 'Monaco', 'Courier New', monospace;
    word-break: break-all; /* Break long model names */
    font-size: 0.85em; /* Slightly smaller for long names */
}

.replacements-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 8px;
    border: 1px solid #b0d4ff;
}

.replacements-info h3 {
    color: #0066cc;
    margin-bottom: 10px;
    font-size: 1.1em;
}

#replacementsList {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.replacement-item {
    padding: 5px 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
}

.original-text {
    color: #dc3545;
    font-weight: 600;
}

.arrow {
    color: #666;
    margin: 0 10px;
}

.replacement-text {
    color: #28a745;
    font-weight: 600;
}

/* Not anonymized names panel */
.not-anonymized-info {
    margin-top: 20px;
    padding: 15px;
    background: #fff8f0;
    border-radius: 8px;
    border: 1px solid #ffd7a8;
}

.not-anonymized-info h3 {
    color: #d97706;
    margin-bottom: 10px;
    font-size: 1.1em;
}

#notAnonymizedList {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.not-anon-item {
    padding: 5px 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.not-anon-name {
    color: #b91c1c;
    font-weight: 600;
}

.not-anon-reason {
    color: #6b7280;
}

.highlighted-pii {
    background: rgba(147, 197, 253, 0.4);
    color: #1d4ed8;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    border-bottom: 2px dotted rgba(59, 130, 246, 0.8);
    transition: background 0.2s, color 0.2s;
}

.highlighted-pii:hover {
    background: rgba(96, 165, 250, 0.65);
    color: #1e3a8a;
}

.not-anonymized-highlight {
    background: rgba(253, 186, 116, 0.35);
    color: #b45309;
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom: 2px dotted rgba(251, 191, 36, 0.8);
}

.not-anonymized-highlight:hover {
    background: rgba(253, 186, 116, 0.55);
    color: #92400e;
}

.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.pii-category {
    margin: 15px 0;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.pii-category h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1em;
}

.pii-list {
    list-style: none;
    padding-left: 20px;
}

.pii-list li {
    padding: 3px 0;
    color: #555;
}

.pii-list li::before {
    content: '▸ ';
    color: #667eea;
    font-weight: bold;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#llmStatus {
    font-weight: bold;
    color: #90ee90;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .button-group {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
