/*
 * KeepTrack Documentation Platform - Custom Styles
 * Additional custom styles beyond Bootstrap 5
 */

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f1f1f1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color, #667eea);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover, #5568d3);
}

/* Print styles */
@media print {
    .navbar,
    footer,
    .sidebar,
    .btn {
        display: none !important;
    }

    .document-content {
        max-width: 100%;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        top: 0;
        margin-top: 2rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .search-box input {
        min-width: 150px;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color, rgba(255,255,255,.3));
    border-radius: 50%;
    border-top-color: var(--primary-color, #667eea);
    animation: spin 1s ease-in-out infinite;
}

/* Spinner variant for buttons with light background */
.btn-light .spinner,
.btn-outline-light .spinner {
    border-color: rgba(0,0,0,.2);
    border-top-color: var(--text-primary, #212529);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notifications (if needed) */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
}

/* Code block improvements */
.document-content pre[class*="language-"] {
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* Table improvements */
.document-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.document-content table th,
.document-content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

.document-content table thead th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Blockquote styling */
.document-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #6c757d;
    font-style: italic;
}

/* Link styling in content */
.document-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.document-content a:hover {
    border-bottom-color: #667eea;
}

/* Image styling in content */
.document-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ======================
   API Documentation Styles
   ====================== */

/* Response Code Badges */
.response-code {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.response-code-200 { background-color: var(--alert-success-bg, #d4edda); color: var(--alert-success-text, #155724); }
.response-code-201 { background-color: var(--alert-success-bg, #d4edda); color: var(--alert-success-text, #155724); }
.response-code-204 { background-color: var(--alert-info-bg, #d1ecf1); color: var(--alert-info-text, #0c5460); }
.response-code-400 { background-color: var(--alert-danger-bg, #f8d7da); color: var(--alert-danger-text, #721c24); }
.response-code-401 { background-color: var(--alert-danger-bg, #f8d7da); color: var(--alert-danger-text, #721c24); }
.response-code-403 { background-color: var(--alert-danger-bg, #f8d7da); color: var(--alert-danger-text, #721c24); }
.response-code-404 { background-color: var(--alert-danger-bg, #f8d7da); color: var(--alert-danger-text, #721c24); }
.response-code-500 { background-color: var(--alert-danger-bg, #f8d7da); color: var(--alert-danger-text, #721c24); }

/* Parameter Tables */
.param-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.param-table th {
    background-color: var(--bg-secondary, #f8f9fa);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--border-color, #dee2e6);
}

.param-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color, #dee2e6);
    vertical-align: top;
}

.param-name {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--text-primary, #495057);
}

.param-type {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary, #6c757d);
    background-color: var(--bg-tertiary, #f8f9fa);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.param-required {
    color: var(--danger-color, #dc3545);
    font-weight: 600;
    font-size: 0.75rem;
}

.param-optional {
    color: var(--text-muted, #6c757d);
    font-style: italic;
    font-size: 0.75rem;
}

/* API Request/Response Blocks */
.api-block {
    background-color: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
}

.api-block-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #495057);
}

.api-block pre {
    background-color: var(--code-bg, #282c34);
    color: var(--code-text, #abb2bf);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0 0 0;
}

/* Language Toggle for Code Examples */
.code-lang-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.code-lang-toggle .btn {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
}

/* Endpoint Section */
.endpoint-section {
    background-color: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--card-shadow, 0 2px 4px rgba(0,0,0,0.05));
}

.endpoint-section h3 {
    margin-top: 0;
    color: var(--text-primary, #212529);
}

/* Authentication Badge */
.auth-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--alert-warning-bg, #fff3cd);
    border: 1px solid var(--warning-color, #ffc107);
    color: var(--alert-warning-text, #856404);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Try It Out Section */
.try-it-out {
    background-color: var(--alert-info-bg, #e7f3ff);
    border-left: 4px solid var(--primary-color, #0d6efd);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.try-it-out-header {
    font-weight: 600;
    color: var(--primary-color, #0d6efd);
    margin-bottom: 0.5rem;
}

/* Success/Error Message Examples */
.example-success {
    background-color: var(--alert-success-bg, #d4edda);
    border-left: 4px solid var(--success-color, #28a745);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.example-error {
    background-color: var(--alert-danger-bg, #f8d7da);
    border-left: 4px solid var(--danger-color, #dc3545);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

/* API Changelog */
.api-changelog {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.api-changelog .version {
    font-weight: 600;
    color: #495057;
}

.api-changelog .date {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Deprecation Warning */
.deprecation-warning {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
}

.deprecation-warning strong {
    color: #856404;
}

/* Rate Limit Info */
.rate-limit-info {
    background-color: #e7f3ff;
    border: 1px solid #0d6efd;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}

/* Responsive API Docs */
@media (max-width: 768px) {
    .param-table {
        font-size: 0.85rem;
    }

    .param-table th,
    .param-table td {
        padding: 0.5rem;
    }

    .endpoint-section {
        padding: 1rem;
    }

    .api-block pre {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
}

/* ======================
   Toast Notifications
   ====================== */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-in-out;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(400px);
}

.toast-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.toast-message {
    flex-grow: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* Toast Types */
.toast-success {
    border-left: 4px solid #28a745;
}

.toast-success .toast-icon {
    color: #28a745;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-info {
    border-left: 4px solid #0d6efd;
}

.toast-info .toast-icon {
    color: #0d6efd;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ======================
   Callout Boxes
   ====================== */

.callout {
    display: block;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid;
}

.callout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.callout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.callout-icon svg {
    width: 20px;
    height: 20px;
}

.callout-title {
    font-weight: 600;
    font-size: 1rem;
}

.callout-body {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Info Callout */
.callout-info {
    background-color: #e7f3ff;
    border-color: #0d6efd;
    color: #084298;
}

.callout-info .callout-icon {
    color: #0d6efd;
}

.callout-info .callout-title {
    color: #084298;
}

/* Warning Callout */
.callout-warning {
    background-color: #fff8e6;
    border-color: #ffc107;
    color: #664d03;
}

.callout-warning .callout-icon {
    color: #ffc107;
}

.callout-warning .callout-title {
    color: #664d03;
}

/* Success Callout */
.callout-success {
    background-color: #d4edda;
    border-color: #198754;
    color: #0f5132;
}

.callout-success .callout-icon {
    color: #198754;
}

.callout-success .callout-title {
    color: #0f5132;
}

/* Danger Callout */
.callout-danger {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #842029;
}

.callout-danger .callout-icon {
    color: #dc3545;
}

.callout-danger .callout-title {
    color: #842029;
}

/* ======================
   Checkbox Lists
   ====================== */

.checkbox-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.checkbox-item {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    margin-top: 0.15rem;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
}

.checkbox-input:checked + .checkbox-text {
    text-decoration: line-through;
    color: #6c757d;
}

.checkbox-text {
    flex-grow: 1;
}

/* Trumbowyg Editor Styles for Callouts & Checkboxes */
.trumbowyg-editor .callout {
    margin: 0.5rem 0;
}

.trumbowyg-editor .checkbox-list {
    margin: 0.5rem 0;
}

/* Dark Mode Callouts */
[data-theme="dark"] .callout-info {
    background-color: rgba(13, 110, 253, 0.15);
    color: #6ea8fe;
}

[data-theme="dark"] .callout-info .callout-title {
    color: #6ea8fe;
}

[data-theme="dark"] .callout-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffda6a;
}

[data-theme="dark"] .callout-warning .callout-title {
    color: #ffda6a;
}

[data-theme="dark"] .callout-success {
    background-color: rgba(25, 135, 84, 0.15);
    color: #75b798;
}

[data-theme="dark"] .callout-success .callout-title {
    color: #75b798;
}

[data-theme="dark"] .callout-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: #ea868f;
}

[data-theme="dark"] .callout-danger .callout-title {
    color: #ea868f;
}

/* Print Styles for Callouts */
@media print {
    .callout {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }

    .checkbox-list {
        page-break-inside: avoid;
    }
}
