* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0a;
    --card-bg: #1a2e1a;
    --card-border: #2d4a2d;
    --text-primary: #ffffff;
    --text-secondary: #8b9d8b;
    --input-bg: #152415;
    --input-border: #2d4a2d;
    --btn-primary: #3a5a3a;
    --btn-hover: #4a6a4a;
    --accent-blue: #4a9eff;
    --accent-green: #5eff5a;
    --error-red: #ff4a4a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-direction: column;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--btn-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--btn-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--card-border);
}

.btn-secondary:hover {
    border-color: var(--btn-hover);
    background: rgba(58, 90, 58, 0.2);
}

.btn-danger {
    background: red;
    color: white;
    width: 100%;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn i {
    margin-right: 0.5rem;
}

.btn-small i {
    margin-right: 0.35rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group label i {
    margin-right: 0.5rem;
    opacity: 0.7;
}

.form-group input,
.form-group textarea {
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group textarea {
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--btn-hover);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.form-group small i {
    margin-right: 0.35rem;
}

.back-link {
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

.error-message {
    color: var(--error-red);
    font-size: 0.9rem;
    text-align: center;
    min-height: 20px;
}

.dashboard-body {
    display: block;
    align-items: stretch;
}

.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 250px;
    background: #0f0f0f;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    margin-bottom: 30px;
    padding: 10px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-item {
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--card-bg);
    color: var(--text-primary);
}

.nav-item .icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    margin-top: 20px;
}

.user-info {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-auth {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    word-break: break-all;
}

#logoutBtn i {
    margin-right: 0.5rem;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    text-align: left;
    margin-bottom: 0;
}

.user-welcome {
    color: var(--text-secondary);
    margin-top: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(94, 255, 90, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--accent-green);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-green);
}

.configs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-info h3 {
    margin-bottom: 5px;
}

.config-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.config-actions {
    display: flex;
    gap: 10px;
}

.scripts-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.code-editor-section,
.available-scripts-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.editor-header h3 {
    font-size: 0.85rem;
    color: white;
    letter-spacing: 1px;
}

.script-actions {
    display: flex;
    gap: 10px;
}

.current-script-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #0a0a0a;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    margin-bottom: 10px;
}

.script-name-display {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

.script-name-display i {
    margin-right: 0.5rem;
    color: var(--accent-green);
}

.code-editor-wrapper {
    display: flex;
    background: #0a0a0a;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 400px;
    max-height: 500px;
}

.line-numbers {
    background: #050505;
    border-right: 1px solid var(--input-border);
    color: #4a4a4a;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 15px 10px;
    text-align: right;
    user-select: none;
    min-width: 50px;
    max-width: 50px;
    overflow-y: hidden;
    overflow-x: hidden;
    flex-shrink: 0;
}

.line-numbers div {
    height: 1.52em;
    white-space: nowrap;
}

.code-editor {
    width: 100%;
    height: 100%;
    min-height: 500px;
    max-height: 600px;
    background: transparent;
    border: none;
    padding: 15px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
    overflow-x: auto;
    transition: none;
    white-space: pre;
}

.code-editor:focus {
    outline: none;
}

.code-editor::placeholder {
    color: #4a4a4a;
}

.code-editor::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.code-editor::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: var(--btn-primary);
}

.code-editor::-webkit-scrollbar-corner {
    background: #0a0a0a;
}

.available-scripts-section h3 {
    font-size: 0.85rem;
    color: white;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.available-scripts-section h3 i {
    margin-right: 0.5rem;
}

.scripts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.script-item {
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    user-select: none;
}   

.script-item.active {
    border-color: var(--accent-green);
    background: var(--input-bg);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    /* animation: slideIn 0.3s ease; */
}

.modal-small {  
    max-width: 500px;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-header h2 i {
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

.close {
    color: var(--text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }
    
    .scripts-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .line-numbers {
        min-width: 40px;
        padding: 15px 8px;
    }
}