/* Main application styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar {
    background-color: #343a40;
    padding: 10px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    color: white;
    /* Flexbox layout for responsive design */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Change from space-between to flex-start for left alignment */
    justify-content: flex-start;
    gap: 10px;
}

.navbar > div:last-child {
    /* Keep flexbox but remove justify-content: flex-end */
    float: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* Remove justify-content: flex-end */
    margin-left: auto; /* This will push the buttons to the right */
}

.navbar a {
    color: white;
    text-decoration: none;
    margin-right: 15px;
    /* Ensure buttons don't break on small screens */
    white-space: nowrap;
    padding: 5px 10px;
}

.navbar a:hover {
    color: #ddd;
}

/* Remove right margin from last button */
.navbar a:last-child {
    margin-right: 0;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 15px;
        gap: 8px;
    }

    .navbar > div:last-child {
        width: 100%;
        justify-content: flex-start;
        margin-top: 5px;
        gap: 8px;
        margin-left: 0; /* Remove auto margin on small screens */
    }

    .navbar a {
        margin-right: 10px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar > div:last-child {
        justify-content: space-between;
        gap: 5px;
    }

    .navbar a {
        font-size: 14px;
        padding: 3px 6px;
        margin-right: 8px;
    }
}

/* More compact version for more buttons */
@media (max-width: 600px) {
    .navbar {
        font-size: 14px;
    }

    .navbar strong, .user-role {
        display: inline-block;
    }

    .navbar > div:last-child {
        flex-wrap: wrap;
    }

    .navbar a {
        flex: 1 0 auto;
        text-align: center;
        margin-right: 5px;
        margin-bottom: 3px;
        padding: 3px 6px;
        background-color: rgba(255,255,255,0.1);
        border-radius: 3px;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.table th, .table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.table th {
    background-color: #f2f2f2;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-success {
    background-color: #28a745;
}

.btn-primary {
    background-color: #007bff;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.btn-outline-success {
    background-color: transparent;
    border: 1px solid #28a745;
    color: #28a745;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid #007bff;
    color: #007bff;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn-outline-warning {
    background-color: transparent;
    border: 1px solid #ffc107;
    color: #ffc107;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-xs:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

/* Font Awesome icon fixes */
.fas {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-style: normal;
    margin-right: 4px;
}

/* Ensure icons are properly sized and aligned */
.btn-xs .fas {
    font-size: 10px;
    margin-right: 3px;
}

/* For outline buttons */
.btn-outline-secondary .fas {
    color: inherit;
}

.btn-outline-primary .fas {
    color: inherit;
}

/* Hover state for outline buttons */
.btn-outline-secondary:hover .fas,
.btn-outline-primary:hover .fas {
    color: white;
}

.btn-primary.btn-xs {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-primary.btn-xs:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-danger.btn-xs {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.btn-danger.btn-xs:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
}

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control.is-invalid {
    width: 95%;
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 80%;
    color: #dc3545;
}

select.form-control.is-invalid {
    background-position: right 1.75rem center;
}

.jumbotron {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    border-radius: 10px;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
}

.card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-5px);
}

.card-body {
    padding: 20px;
}

.card-title {
    margin-top: 0;
    color: #333;
    font-weight: 600;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-block {
    margin-top: 15px;
    font-weight: 500;
}

.list-unstyled {
    list-style: none;
    padding: 0;
}

.list-unstyled li {
    padding: 3px 0;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 5px;
    font-style: italic;
}

.help-block {
    font-size: 12px;
    margin-top: 5px;
}

.input-group {
    display: flex;
}

.input-group-append {
    display: flex;
}

.input-group-append .btn {
    margin-left: 5px;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.protected-user {
    font-size: 11px;
    font-style: italic;
    color: #6c757d;
}

.table td:last-child {
    width: 150px;
    min-width: 150px;
}

/* Form specific styles */
.form-text.text-muted {
    font-size: 12px;
    color: #6c757d;
}

/* Button hover effects for outline buttons */
.btn-outline-success:hover {
    background-color: #28a745;
    color: white;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    color: white;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    color: #212529;
}

/* Dashboard specific styles */
.card-header.bg-success {
    background-color: #28a745 !important;
}

.card-header.bg-primary {
    background-color: #007bff !important;
}

.card-header.bg-info {
    background-color: #17a2b8 !important;
}

.border-success { border-color: #28a745 !important; }
.border-primary { border-color: #007bff !important; }
.border-info { border-color: #17a2b8 !important; }

/* ===== DASHBOARD SPECIFIC STYLES ===== */

/* Dashboard Cards Layout */
.site-index .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.site-index .col-lg-4 {
    flex: 0 0 30%;
    max-width: 30%;
    padding: 0 10px;
    display: flex;
}

.site-index .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.site-index .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.site-index .card-body {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.site-index .card-title {
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.75rem;
    font-size: 1.5rem;
}

.site-index .card-text {
    color: #666;
    margin-bottom: 1.5rem;
    flex: 1;
}

/* Feature Icons */
.feature-icon {
    font-size: 2.5rem;
    color: #3498db;
    margin-bottom: 1rem;
    text-align: center;
}

/* List Styles */
.site-index .list-unstyled {
    text-align: left;
    margin-bottom: 1.5rem;
}

.site-index .list-unstyled li {
    padding: 0.5rem 0;
    color: #555;
    position: relative;
    padding-left: 1.5rem;
}

.site-index .list-unstyled li:before {
    content: "✓";
    color: #1abc9c;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Dashboard Buttons */
.site-index .btn-primary {
    background-color: #3498db;
    border-color: #3498db;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-top: auto;
}

.site-index .btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
}

/* Quick Access Section */
.quick-access {
    background-color: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    margin-top: 2rem;
}

.quick-access h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.site-index .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.site-index .btn-outline-primary {
    color: #3498db;
    border-color: #3498db;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.site-index .btn-outline-primary:hover {
    background-color: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* Alert Styling */
.site-index .alert-warning {
    border-radius: 12px;
    border-left: 5px solid #ffc107;
    padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .site-index .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .site-index .card {
        margin-bottom: 1.5rem;
    }

    .site-index .btn-group .btn {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 768px) {
    .site-index .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .site-index .jumbotron {
        padding: 2rem 1rem;
    }

    .site-index .card-body {
        padding: 1.5rem;
    }

    .site-index .btn-group {
        flex-direction: column;
    }

    .site-index .btn-group .btn {
        width: 100%;
        text-align: center;
    }
}

/* Jumbotron Styling */
.site-index .jumbotron {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    padding: 3rem 2rem;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.site-index .jumbotron h1 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.site-index .jumbotron .lead {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Text Alignment */
.text-center {
    text-align: center;
}

.text-start {
    text-align: left;
}

/* Margin Utilities */
.mt-5 {
    margin-top: 3rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.json-editor-container {
    position: relative;
}

/* JSON Editor */
.json-editor {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    tab-size: 4;
}

.json-editor-tools {
    margin-top: 5px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.json-editor-tools .btn {
    font-size: 11px;
    padding: 2px 6px;
}

.json-valid {
    border-color: #28a745 !important;
    background-color: #f8fff9;
}

.json-invalid {
    border-color: #dc3545 !important;
    background-color: #fff8f8;
}

.json-line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background-color: #f5f5f5;
    border-right: 1px solid #ddd;
    padding: 8px 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #666;
    text-align: right;
    overflow: hidden;
}

/* User list */
.tooltip-trigger {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #666;
    display: inline-block;
}

.tooltip-trigger:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

.tooltip-trigger:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    margin-bottom: 3px;
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* Hide tooltip if empty */
.tooltip-trigger[data-tooltip=""]:hover::before,
.tooltip-trigger[data-tooltip=""]:hover::after {
    display: none;
}

.tooltip-trigger:hover {
    color: #007bff;
}

.delete-user-btn {
    margin-left: 5px;
}

/* User credentials */
.user-credentials-alert {
    background: white;
    border-radius: 5px;
    padding: 20px;
    border: 1px solid #dee2e6;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.credentials-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
}

.credential-item {
    margin-bottom: 15px;
}

.credential-item label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.credential-field {
    background-color: white;
}

.copy-btn, .copy-all-btn {
    min-width: 120px;
}

.credential-item .input-group {
    margin-bottom: 10px;
}

/* User form */
/* Style for disabled options in dropdown */
select option:disabled {
    color: #999 !important;
    background-color: #f8f9fa !important;
    font-style: italic;
}

/* Tooltip styles */
select option {
    cursor: help;
}

select option:not(:disabled) {
    cursor: pointer;
}

/* Password field styles */
#user-password[readonly] {
    background-color: #e9ecef !important;
    border-color: #ced4da;
}