/* SRT Feed Manager - Custom Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.2s ease-in-out;
}

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

html {
    font-size: 14px;
}

body {
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Customization */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1.5rem;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.navbar-brand i {
    font-size: 1.3rem;
}

/* Main Content */
main.container-fluid {
    max-width: 1600px;
    flex: 1;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* Table Styles */
.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
    border-bottom: 2px solid #dee2e6;
    padding: 0.875rem 0.75rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

/* Badge Styles */
.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
    font-size: 0.75rem;
}

.node-source {
    background-color: #cfe2ff;
    color: #084298;
}

.node-destination {
    background-color: #d1e7dd;
    color: #0f5132;
}

.protocol-srt {
    background-color: #fff3cd;
    color: #664d03;
}

/* Button Styles */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
}

.btn-outline-secondary:hover,
.btn-outline-light:hover {
    transform: translateY(-1px);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

.action-buttons .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Form Styles */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border-color: #dee2e6;
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-control::placeholder {
    color: #adb5bd;
}

/* Input Group */
.input-group-text {
    background-color: var(--light-color);
    border-color: #dee2e6;
}

/* SRT URL Display */
.font-monospace {
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
    font-size: 0.85rem;
}

#srt_url {
    background-color: #e9ecef;
    cursor: default;
}

/* Modal Styles */
.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    display: flex;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* Search and Filter Bar */
#search-input {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

#btn-clear-search {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* Empty and Loading States */
#empty-state,
#loading-state {
    padding: 3rem;
}

#empty-state i,
#loading-state .spinner-border {
    opacity: 0.5;
}

/* Toast Notifications */
.toast {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-header {
    border-bottom: none;
    padding-bottom: 0;
}

.toast-body {
    padding-top: 0.5rem;
}

/* Stats Badge */
#stats-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
}

/* Truncate long text */
.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.truncate-url {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

/* SRT URL cell with hover copy button */
.srt-url-cell {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.srt-url-copy-btn {
    background: none;
    border: none;
    padding: 0.1rem 0.3rem;
    cursor: pointer;
    color: #adb5bd;
    border-radius: 4px;
    opacity: 0;
    transition:
        opacity 0.15s ease,
        color 0.15s ease,
        background-color 0.15s ease;
    flex-shrink: 0;
    font-size: 0.8rem;
    line-height: 1;
}

.srt-url-cell:hover .srt-url-copy-btn {
    opacity: 1;
}

.srt-url-copy-btn:hover {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.srt-url-copy-btn.copied {
    color: #198754;
    opacity: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Alert Styles */
.alert {
    border-radius: var(--border-radius);
    border: none;
}

#alert-container {
    position: fixed;
    top: 70px;
    right: 1rem;
    z-index: 1050;
    max-width: 400px;
}

#alert-container .alert {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Text Colors */
.text-muted {
    color: #6c757d !important;
}

/* Export Textarea */
#export-text {
    font-size: 0.8rem;
    line-height: 1.5;
    background-color: #f8f9fa;
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    html {
        font-size: 13px;
    }

    .navbar-collapse {
        background-color: var(--primary-color);
        padding: 1rem;
        border-radius: var(--border-radius);
        margin-top: 0.5rem;
    }

    .navbar-nav {
        margin-bottom: 0.5rem;
    }

    #stats-badge {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .table-responsive {
        max-height: none;
    }

    .truncate,
    .truncate-url {
        max-width: 120px;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .card:first-child,
    .action-buttons,
    .btn {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .table {
        font-size: 10pt;
    }
}

/* Animation for new items */
@keyframes highlight {
    0% {
        background-color: #fff3cd;
    }
    100% {
        background-color: transparent;
    }
}

.highlight-new {
    animation: highlight 2s ease-out;
}

/* Hover effects for clickable items */
[data-href],
.clickable {
    cursor: pointer;
}

[data-href]:hover {
    text-decoration: underline;
}

/* Status indicators */
.status-active {
    color: var(--success-color);
}

.status-inactive {
    color: var(--danger-color);
}

/* Tooltip styling */
[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Custom checkbox styling */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Select dropdown styling */
.form-select {
    cursor: pointer;
}

/* Footer styles (if needed) */
footer {
    background-color: var(--light-color);
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border-top: 1px solid #dee2e6;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
