/* Base Styles */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --body-bg: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
    --mp-blue: #00b1ff;
    --mp-dark-blue: #0077b3;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--body-bg);
}

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

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

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

a:hover {
    text-decoration: underline;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    color: var(--mp-blue);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    cursor: pointer;
}

.btn:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn.primary {
    color: #fff;
    background-color: var(--mp-blue);
    border-color: var(--mp-blue);
}

.btn.primary:hover {
    background-color: var(--mp-dark-blue);
    border-color: var(--mp-dark-blue);
}

.btn.secondary {
    color: #fff;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

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

.btn.tertiary {
    color: var(--text-color);
    background-color: transparent;
    border-color: var(--border-color);
}

.btn.tertiary:hover {
    background-color: var(--light-color);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
textarea {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    color: var(--text-color);
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea {
    resize: vertical;
}

.form-actions {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
}

.checkbox {
    display: flex;
    align-items: center;
}

.checkbox input {
    margin-right: 10px;
    width: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
}

/* Main Sections */
.tool-section,
.results-section {
    background-color: var(--card-bg);
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Results Section */
.results-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.summary-item {
    flex: 1;
    min-width: 100px;
    background-color: var(--light-color);
    border-radius: 5px;
    padding: 15px;
    text-align: center;
}

.summary-item .count {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--mp-blue);
}

.summary-item .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.results-actions {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 10px;
}

.results-table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

table th,
table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--light-color);
}

table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.03);
}

table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
}

/* Status Indicators */
.status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: bold;
}

.status-public {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.status-private {
    background-color: rgba(23, 162, 184, 0.2);
    color: var(--info-color);
}

.status-active {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.status-inactive,
.status-archived {
    background-color: rgba(108, 117, 125, 0.2);
    color: var(--secondary-color);
}

.status-error {
    background-color: rgba(220, 53, 69, 0.2);
    color: var(--danger-color);
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--mp-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* API Info */
.api-info {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.api-info h3 {
    margin-bottom: 10px;
}

.api-info ol {
    padding-left: 20px;
}

.api-info li {
    margin-bottom: 5px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .summary-item {
        min-width: 80px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .results-actions .btn {
        width: 100%;
    }
}

/* Table Styles */
.expand-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--mp-blue);
}

.expand-button:hover {
    color: var(--mp-dark-blue);
}

.expand-button i {
    transition: transform 0.2s ease-in-out;
}

.expand-button i.fa-chevron-down {
    transform: rotate(90deg);
}

.details-row {
    background-color: #f8f9fa;
}

.details-content {
    padding: 15px;
    border-top: 1px solid #dee2e6;
}

.details-content h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057;
}

.details-content p {
    margin: 5px 0;
    color: #212529;
}

.details-content a {
    color: #0d6efd;
    text-decoration: none;
}

.details-content a:hover {
    text-decoration: underline;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-section {
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.detail-section h4 {
    color: var(--mp-blue);
    margin-bottom: 10px;
    font-size: 1rem;
}

.detail-item {
    margin-bottom: 8px;
}

.detail-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-color);
    word-break: break-word;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background-color: rgba(0, 177, 255, 0.1);
    color: var(--mp-blue);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-top: 10px;
}

.mp-link {
    display: inline-flex;
    align-items: center;
    color: var(--mp-blue);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mp-link:hover {
    background-color: rgba(0, 177, 255, 0.1);
    text-decoration: none;
}

.mp-link i {
    margin-right: 6px;
}

.link-separator {
    margin: 0 8px;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background-color: rgba(0, 177, 255, 0.1);
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    background-color: rgba(0, 177, 255, 0.15);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--mp-blue);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-details {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: rgba(0, 177, 255, 0.05);
    padding: 5px;
    border-radius: 4px;
}

.stat-details div {
    margin: 2px 0;
}

.mt-3 {
    margin-top: 15px;
}

.editable-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editable-field .current-value {
    flex: 1;
}

.edit-button,
.action-button {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.edit-button:hover,
.action-button:hover {
    background-color: var(--light-color);
    border-color: var(--mp-blue);
    color: var(--mp-blue);
}

.edit-button i,
.action-button i {
    margin-right: 4px;
}

.action-button {
    margin-left: 10px;
}

/* Sortable Table Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

th.sortable:hover {
    background-color: rgba(0, 177, 255, 0.1);
}

.sort-indicator {
    color: var(--text-muted);
    font-size: 0.8em;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.sort-indicator.active {
    color: var(--mp-blue);
}
