/* PyRASP Config - Dark Cybersecurity Theme */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #fffc44;
    --accent-hover: #fffd77;
    --accent-dim: rgba(255, 252, 68, 0.15);
    --danger: #f85149;
    --warning: #d29922;
    --info: #58a6ff;
    --success: #3fb950;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --sidebar-width: 280px;
}

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

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.sidebar-brand h1 a {
    color: inherit;
    text-decoration: none;
}

.sidebar-brand h1 a:hover {
    opacity: 0.8;
}

.sidebar-brand .subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

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

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.sidebar-nav .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

/* Editing indicator */
.editing-indicator {
    padding: 10px 20px;
    margin: 4px 12px 8px;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-size: 12px;
    color: var(--accent);
}

.editing-indicator .editing-label {
    display: block;
    line-height: 1.4;
    word-break: break-word;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 40px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

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

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.data-table th {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* Panel */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 24px;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-body {
    padding: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: 600;
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification.success {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.notification.error {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.notification.info {
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid var(--info);
    color: var(--info);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

/* Home page menu cards */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.menu-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.menu-card:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.menu-card .card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.menu-card .card-label {
    font-size: 14px;
    font-weight: 500;
}

.menu-card .card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

/* Danger button */
.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}

.btn-danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

/* Version badge */
.version-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

/* Small caps for template names */
.template-name {
    font-variant: small-caps;
    text-transform: lowercase;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* Actions cell */
.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Muted text helper */
.text-muted {
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 14px;
    margin-top: 8px;
}

/* Field description */
.field-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: 6px;
}

/* Toggle switch */
label.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 0;
}

.toggle-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 22px;
    transition: all 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--accent);
}

/* List editor */
.list-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-editor-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.list-editor-row .form-control {
    flex: 1;
}

.btn-remove-row {
    width: 32px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.btn-add-row {
    align-self: flex-start;
    margin-top: 4px;
}

/* List pair header */
.list-pair-header {
    display: flex;
    gap: 8px;
    padding: 0 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.list-pair-header span:first-child {
    flex: 1;
}

.list-pair-header span:nth-child(2) {
    width: 140px;
}

.list-pair-header span:last-child {
    width: 32px;
}

.list-pair-row select.form-control {
    width: 140px;
    flex: none;
}

/* Security checks table */
.security-checks-table {
    margin-bottom: 0;
}

.security-checks-table td {
    vertical-align: middle;
}

.security-checks-table td:first-child {
    font-weight: 500;
}

.security-checks-table td:last-child {
    width: 240px;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
}

/* Boolean grid */
.boolean-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-brand h1,
    .sidebar-brand .subtitle,
    .sidebar-nav .nav-label {
        display: none;
    }
    .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        margin-left: 60px;
        padding: 20px;
    }
    .menu-grid {
        grid-template-columns: 1fr;
    }
}
