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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header */
header {
    background-color: #0078d4;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

/* Navigation */
nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Auth Section */
.auth-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.user-info {
    margin-right: 1rem;
    font-size: 0.9rem;
}

/* Main Content */
main {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #0078d4;
}

.page-subtitle {
    font-size: 1.2rem;
    color: #666;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #0078d4;
}

.card-description {
    color: #666;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    margin: 0.25rem;
    background-color: #0078d4;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #106ebe;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: none;
}

.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    position: relative;
    padding-right: 2.5rem;
    /* Make room for dismiss button */
}

.error-message a {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 500;
}

.error-message a:hover {
    color: #004080;
    text-decoration: none;
}

.error-message .dismiss-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #721c24;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.error-message .dismiss-btn:hover {
    background-color: rgba(114, 28, 36, 0.1);
}

.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.success-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Profile Page */
.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.profile-field {
    margin-bottom: 1rem;
}

.profile-label {
    font-weight: bold;
    color: #0078d4;
    display: block;
    margin-bottom: 0.25rem;
}

.profile-value {
    color: #333;
    word-break: break-word;
}

.json-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    overflow-x: auto;
}

.json-content pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}


.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s;
    border-bottom: 1px solid #f8f9fa;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #0078d4;
}

.dropdown-item:focus {
    background-color: #e3f2fd;
    color: #0078d4;
    outline: none;
}

/* Account Button Styles */
.btn-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-account:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

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

/* Version Switcher Styles */
.version-switcher {
    position: relative;
    display: inline-block;
}

.btn-version {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-version:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.version-icon {
    font-size: 1rem;
}

.version-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    z-index: 1000;
    display: none;
    overflow: hidden;
    margin-top: 0.25rem;
}

.version-switcher.active .version-menu {
    display: block;
}

.version-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.version-item:last-child {
    border-bottom: none;
}

.version-item:hover {
    background-color: #f8f9fa;
}

.version-item.active {
    background-color: #e3f2fd;
    cursor: default;
}

.version-item.active:hover {
    background-color: #e3f2fd;
}

.version-item-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
}

.version-name {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.version-description {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.3;
}

.version-active-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #28a745;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.dropdown-separator {
    height: 1px;
    background-color: #dee2e6;
    margin: 0.5rem 0;
}

.action-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #0078d4;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.action-item:hover {
    background-color: #e3f2fd;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Custom Version Modal Styles */
.custom-version-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.form-input:invalid {
    border-color: #dc3545;
}

.input-help {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.error-text {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.example-versions {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #0078d4;
}

.version-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.version-tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background-color: #e3f2fd;
    color: #0078d4;
    border: 1px solid #bbdefb;
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: 'Consolas', 'Monaco', monospace;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.version-tag:hover {
    background-color: #0078d4;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 120, 212, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-primary:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow: hidden;
    position: relative;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

/* Account List Styles */
.account-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.account-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: white;
}

.account-item:hover {
    background-color: #f8f9fa;
    border-color: #0078d4;
}

.account-item.add-account {
    border-style: dashed;
    color: #0078d4;
}

.account-item.add-account:hover {
    background-color: rgba(0, 120, 212, 0.05);
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #0078d4;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.account-avatar.add-icon {
    background-color: transparent;
    border: 2px solid #0078d4;
    color: #0078d4;
    font-size: 1.2rem;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.account-username {
    font-size: 0.875rem;
    color: #666;
    word-break: break-all;
}

.account-active-indicator {
    background-color: #28a745;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 1rem;
}

/* Responsive adjustments for custom version modal */
@media (max-width: 768px) {
    .custom-version-form {
        padding: 1rem;
    }

    .version-tags {
        gap: 0.25rem;
    }

    .version-tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90%;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .account-item {
        padding: 0.75rem;
    }

    .account-avatar {
        width: 35px;
        height: 35px;
        margin-right: 0.75rem;
    }
}