/**
 * Admin Panel Styles
 */

/* Layout */
body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-header .logo {
    font-size: 2rem;
    margin-bottom: 8px;
}

.sidebar-header h1 {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: white;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--error);
    color: white;
}

.main {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-success .stat-value { color: var(--success); }
.stat-warning .stat-value { color: var(--warning); }
.stat-error .stat-value { color: var(--error); }
.stat-info .stat-value { color: var(--info); }

/* Quick Actions */
.quick-actions h3 {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

/* API Toast Notification */
.api-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    z-index: 1000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.api-toast.loading { border-color: var(--info); }
.api-toast.success { border-color: var(--success); color: var(--success); }
.api-toast.error { border-color: var(--error); color: var(--error); }
.api-toast small { color: var(--text-muted); }

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.action-icon { font-size: 2rem; }
.action-title { font-weight: 600; color: var(--text-primary); }
.action-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Filters */
.filters {
    margin-bottom: 20px;
}

.filters-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filters-form .form-input {
    max-width: 200px;
}

/* Login Box */
.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.logo-big {
    font-size: 3rem;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 1.5rem;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main {
        margin-left: 0;
        padding: 16px;
    }
    
    .generate-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .generate-option .form-input {
        width: 100%;
    }
    
    .generate-option-btn {
        margin-left: 0;
    }
}

/* Alerts */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    margin: 20px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.modal-warning {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.modal-warning strong {
    display: block;
    margin-bottom: 8px;
}

.modal-warning ul {
    margin: 0;
    padding-left: 20px;
}

.modal-warning li {
    margin-bottom: 4px;
}

.modal-warning code {
    color: var(--error);
    font-size: 0.85rem;
}

.modal-note {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Alerts */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

/* Generate Page Options */
.generate-options {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.generate-option {
    display: flex;
    flex-direction: column;
}

.generate-option label {
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
}

.generate-option .form-input {
    width: 120px;
}

.generate-option-checkbox {
    min-width: 200px;
    align-self: flex-end;
}

.generate-option-checkbox .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
}

.generate-option-checkbox .checkbox-text {
    font-weight: 500;
}

.generate-option-checkbox .checkbox-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;
    padding-left: 26px;
}

.generate-option-btn {
    margin-left: auto;
}

/* Event Stats - inline badges */
.event-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.event-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s;
    min-width: 100px;
}

.event-stat:hover {
    border-color: var(--accent);
}

.event-stat.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.event-stat .stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.event-stat .stat-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.event-stat.stat-success .stat-num { color: var(--success); }
.event-stat.stat-error .stat-num { color: var(--error); }
.event-stat.stat-warning .stat-num { color: var(--warning); }
.event-stat.stat-muted .stat-num { color: var(--text-muted); }

/* Events table extras */
.nowrap {
    white-space: nowrap;
}

.text-mono {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Events cleanup card */
.events-cleanup-card {
    margin-top: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.cleanup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.cleanup-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.cleanup-icon {
    font-size: 1.2rem;
}

.cleanup-form .cleanup-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cleanup-form label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cleanup-form .form-input {
    width: auto;
    min-width: 150px;
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-text {
    color: var(--text-primary);
    font-weight: 500;
}

.checkbox-hint {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Result extras */
.result-skipped {
    color: var(--warning);
    font-weight: normal;
    margin-left: 8px;
}

/* Obfuscation page */
.obfuscate-info h3 {
    margin-bottom: 16px;
}

.obfuscate-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.obfuscate-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 32px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.obfuscate-stat .stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.obfuscate-stat.stat-accent .stat-num {
    color: var(--accent);
}

.obfuscate-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.source-path {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.source-path code {
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--success);
}

.setup-instructions {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.setup-instructions h4 {
    margin-bottom: 12px;
}

.setup-instructions ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.setup-instructions ol li {
    margin-bottom: 8px;
}

.setup-instructions pre {
    background: #1a1a2e;
    color: var(--text-secondary);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    overflow-x: auto;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    border-color: var(--accent);
}

.option-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.option-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.option-card-warn {
    border-color: rgba(245, 158, 11, 0.3);
}

.option-card-warn:hover {
    border-color: var(--warning);
}

.option-card-warn:has(input:checked) {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.option-warn {
    display: block;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--warning);
}

/* Card headers need margin */
.card h3 {
    margin-bottom: 16px;
}

.process-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    margin-bottom: 4px;
}

.step-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.warnings-list {
    margin-left: 20px;
}

.warnings-list li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.warnings-list li strong {
    color: var(--warning);
}

/* Key copy button */
.key-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    user-select: all;
}

.btn-copy {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-copy.copied {
    background: var(--success);
    border-color: var(--success);
}

.btn-copy.copy-error {
    background: var(--error);
    border-color: var(--error);
}

/* Mode Selection */
.mode-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card:hover {
    border-color: var(--accent);
}

.mode-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.mode-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mode-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.mode-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mode-desc code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Options Section */
.options-section {
    margin-bottom: 24px;
}

.options-section h4 {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Preset Selection */
.preset-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.preset-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-card:hover {
    border-color: var(--accent);
}

.preset-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.preset-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.preset-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.preset-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Advanced Warning */
.advanced-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: #fcd34d;
}

/* Card top margin utility */
.card-mt {
    margin-top: 20px;
}

/* Product Form */
.product-form .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.product-form .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.product-form .form-group-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    min-height: 62px;
}

.product-form .form-group-btn .btn {
    white-space: nowrap;
    height: 40px;
}

.product-form small {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 4px;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .product-form .form-row {
        flex-direction: column;
    }
    .product-form .form-group-btn {
        min-height: auto;
        width: 100%;
    }
    .product-form .form-group-btn .btn {
        width: 100%;
    }
}
