:root {
    --primary: #8437b8;
    --primary-dark: #692993;
    --secondary: #ff4e7c;
    --secondary-dark: #e53d68;
    --accent: #ffd54c;
    --accent-dark: #e6bf43;
    --bg-dark: #1a1a25;
    --bg-card: #242435;
    --text-light: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border: #3a3a4f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 40px 0;
    position: relative;
    margin-bottom: 30px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://www.starstable.com/en/assets/images/layout/starparticles.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    border-radius: 0 0 20px 20px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    margin-bottom: 15px;
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    font-weight: 300;
}

.ss-logo {
    max-width: 150px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.controls {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
}

.search-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    padding-left: 40px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--bg-dark);
    color: var(--text-light);
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(132, 55, 184, 0.3);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-dropdown {
    position: relative;
}

.filter-btn {
    padding: 12px 20px;
    background-color: var(--bg-dark);
    color: var(--text-light);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary);
}

.filter-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background-color: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    width: 200px;
    z-index: 100;
    border: 1px solid var(--border);
    display: none;
}

.filter-menu.active {
    display: block;
}

.filter-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-option:hover {
    background-color: var(--primary-dark);
}

.filter-option.active {
    background-color: var(--primary);
    color: white;
}

.filter-option:first-child {
    border-radius: 10px 10px 0 0;
}

.filter-option:last-child {
    border-radius: 0 0 10px 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #954bc7, var(--primary));
}

.btn-secondary {
    background: linear-gradient(to right, var(--secondary), var(--secondary-dark));
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #ff6290, var(--secondary));
}

.btn-accent {
    background: linear-gradient(to right, var(--accent), var(--accent-dark));
    color: var(--bg-dark);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #ffe066, var(--accent));
}

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.factions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.faction-card {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

.faction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.faction-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.faction-emoji {
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}

.faction-names {
    flex: 1;
}

.faction-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 3px;
}

.faction-body {
    padding: 20px;
}

.quest-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.quest-table th,
.quest-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.quest-table th {
    font-weight: 600;
    color: var(--primary);
    opacity: 0.9;
}

.quest-table tr:last-child td {
    border-bottom: none;
}

.rep-badge {
    background-color: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
    font-size: 0.85rem;
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    padding: 15px 5px;
    text-align: center;
}

.add-quest-btn {
    margin-top: 15px;
    background-color: transparent;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
}

.add-quest-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(132, 55, 184, 0.05);
}

/* Modal styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(3px);
}

.modal {
    background-color: var(--bg-card);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s forwards;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px 25px;
    position: relative;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--bg-dark);
    color: var(--text-light);
    transition: all 0.3s;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(132, 55, 184, 0.3);
}

.form-group-row {
    display: flex;
    gap: 20px;
}

.form-group-row > div {
    flex: 1;
}

.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    background-color: var(--bg-dark);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.emoji-option {
    font-size: 1.6rem;
    cursor: pointer;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
    background-color: var(--bg-card);
}

.emoji-option:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

.emoji-option.selected {
    background-color: var(--primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}

.modal-footer {
    padding: 20px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid var(--border);
}

.quest-form {
    margin-top: 25px;
    border-top: 1px solid var(--border);
    padding-top: 25px;
}

.quest-list-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    background-color: var(--bg-dark);
    transition: all 0.2s;
}

.quest-list-item:hover {
    background-color: rgba(132, 55, 184, 0.1);
}

.quest-list-item .rep-badge {
    margin-right: 15px;
}

.quest-list-item .quest-id {
    flex: 1;
    margin-left: 10px;
}

.quest-list-item .delete-btn {
    color: var(--secondary);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    padding: 5px;
}

.quest-list-item .delete-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1100;
}

.toast {
    padding: 15px 25px;
    border-radius: 10px;
    margin-top: 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s forwards;
    max-width: 350px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: linear-gradient(to right, #38b2ac, #2c7a7b);
}

.toast-error {
    background: linear-gradient(to right, #e53e3e, #c53030);
}

.toast-warning {
    background: linear-gradient(to right, #ecc94b, #d69e2e);
}

.instructions {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

.instructions h2 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.instructions ol {
    margin-left: 25px;
    margin-top: 15px;
}

.instructions li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.total-reputation {
    background: linear-gradient(to right, var(--primary-dark), var(--primary));
    padding: 15px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    font-size: 1.25rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.total-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Helper classes */
.hidden {
    display: none;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
}

.filter-tag {
    background-color: var(--bg-card);
    color: var(--text-secondary);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.filter-tag:hover {
    background-color: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
}

.filter-tag.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Language toggle */
.language-toggle {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.toggle-container {
    background-color: var(--bg-card);
    border-radius: 25px;
    display: inline-flex;
    position: relative;
    padding: 5px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.toggle-option {
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1;
    position: relative;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.toggle-option.active {
    color: var(--bg-dark);
}

.toggle-slider {
    position: absolute;
    top: 5px;
    left: 5px;
    height: calc(100% - 10px);
    width: 120px;
    background: linear-gradient(to right, var(--accent), var(--accent-dark));
    border-radius: 20px;
    transition: all 0.3s;
}

.toggle-option:last-child.active ~ .toggle-slider {
    transform: translateX(100%);
}

/* Mode switcher */
.mode-switcher {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 40px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card);
    transition: .4s;
    border: 2px solid var(--border);
    border-radius: 34px;
    display: flex;
    align-items: center;
}

.slider:before {
    content: "";
    height: 30px;
    width: 80px;
    background-color: var(--primary);
    transition: .4s;
    border-radius: 30px;
    position: absolute;
    left: 5px;
}

.mode-label {
    position: absolute;
    width: 50%;
    text-align: center;
    z-index: 2;
    font-size: 0.9rem;
    font-weight: 600;
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.3s;
    pointer-events: none;
    color: var(--text-light);
}

.mode-label:first-of-type {
    left: 0;
}

.mode-label:last-of-type {
    right: 0;
}

.switch input:checked + .slider:before {
    transform: translateX(90px);
}

.switch input:checked + .slider .mode-label:first-of-type {
    color: var(--text-muted);
}

.switch input:checked + .slider .mode-label:last-of-type {
    color: var(--text-light);
}

/* Ensure labels are always visible */
.mode-label {
    opacity: 1 !important;
    visibility: visible !important;
}
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 34px;
}

/* JSON Editor */
.view-modes {
    position: relative;
}

.view-mode {
    transition: all 0.3s;
}

.json-editor-container {
    background-color: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.json-editor-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.json-editor-header h3 {
    font-size: 1.2rem;
    color: white;
}

.json-actions {
    display: flex;
    gap: 10px;
}

.json-editor {
    padding: 20px;
}

.json-editor textarea {
    width: 100%;
    min-height: 500px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    padding: 15px;
    border-radius: 10px;
    background-color: var(--bg-dark);
    color: var(--text-light);
    resize: vertical;
    border: 1px solid var(--border);
}

.json-editor textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(132, 55, 184, 0.2);
}

/* Discord link */
.discord-link {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.discord-link p {
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.discord-link a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 600;
}

.discord-link a:hover {
    text-decoration: underline;
    color: var(--accent-dark);
}

.discord-link i {
    font-size: 1.5rem;
    color: #5865F2;
}

/* Edit mode styles */
.edit-only {
    display: none;
}

.edit-mode .edit-only {
    display: flex;
}

.read-mode .faction-edit-btn {
    display: none;
}

/* Faction dropdown selection */
.faction-select {
    width: 100%;
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 20px;
}

.faction-select option {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 10px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .search-filter {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .factions-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .filter-menu {
        width: 100%;
    }

    .toggle-container {
        width: 100%;
    }

    .toggle-option {
        flex: 1;
    }

    .toggle-slider {
        width: calc(50% - 5px);
    }
}