/* web/css/global-layout.css */
/* Shared layout styles for front-end and back-end */

/* === Body === */
body {
    overflow-x: hidden !important;
    visibility: visible !important;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
}

/* === Brand Name === */
.navbar-brand {
    color: #4DB6AC !important;
    font-weight: bold;
}

/* Backend brand name in sidebar */
.app-name {
    color: #4DB6AC !important;
    font-weight: bold;
}

/* === Max-Width Constraints === */
.page-wrapper,
.container,
.wrap,
.container-main {
    max-width: 960px !important;
    margin-right: auto !important;
    margin-left: auto !important;
}

/* === Minimum Content Height === */
.container.pt-5 {
    min-height: calc(100vh - 100px);
}

/* === Utilities === */
.pagination-container .pagination {
    justify-content: center;
}

.no-underline {
    text-decoration: none !important;
}

.no-underline:hover {
    text-decoration: underline !important;
}

.tooltip .tooltip-inner {
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
}

.tooltip .bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #333;
}

/* === Spinner Animation === */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === Form Validation Styling === */
.is-valid .form-control {
    border: 2px solid;
    border-image: linear-gradient(to right, #28a745, #1f7a38) 1;
    box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%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);
    display: block !important;
}

.is-invalid .form-control {
    border: 2px solid;
    border-image: linear-gradient(to right, #dc3545, #a71d2a) 1;
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    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);
}

.invalid-feedback {
    display: none;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: errorFade 0.5s ease-in-out;
}

.invalid-feedback[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
}

.is-invalid .invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: errorFade 0.5s ease-in-out;
}

.form-check-input.is-valid ~ .valid-feedback,
.form-check-input.is-valid ~ .form-check-label,
.is-valid .valid-feedback {
    display: none !important;
    color: inherit !important;
}

@keyframes errorFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* === Global Code Block Styling === */
code {
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #333;
    font-size: 0.875rem;
    word-wrap: break-word;
    position: relative;
}

.code-block-wrapper {
    position: relative;
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.code-copy-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background-color: #0056b3;
}

.code-copy-btn:active {
    background-color: #004085;
}

/* === Global Blockquote Styling === */
blockquote {
    border-left: 4px solid #ccc;
    padding-left: 0.5rem;
    margin: 0 0 1rem 0;
    color: #333;
}

/* === Alert Styling === */
.alert a {
    font-weight: 600;
    text-decoration: underline;
    color: #444;
    transition: color 0.2s ease;
}

.alert a:hover {
    color: #222;
}

.alert-primary {
    color: #333;
}

.alert-primary a {
    color: #4a5e6d;
}

.alert-primary a:hover {
    color: #2f3d4a;
}

.alert-success a {
    color: #2f6846;
}

.alert-success a:hover {
    color: #1f4a31;
}

.alert-warning a {
    color: #856404;
}

.alert-warning a:hover {
    color: #664d03;
}

.alert-danger a {
    color: #721c24;
}

.alert-danger a:hover {
    color: #50141a;
}

.alert-info a {
    color: #0c5460;
}

.alert-info a:hover {
    color: #083a44;
}

.alert a {
    word-break: break-word;
}

/* === Flagged and Deleted Content === */
.flagged-content {
    filter: blur(5px);
    opacity: 0.6;
}

.support-view .flagged-content {
    filter: none !important;
    opacity: 1 !important;
}

.deleted-comment-content.collapsed {
    display: none;
}

/* === Flatpickr Datepicker === */
.input-group .flatpickr-calendar {
    position: absolute !important;
    z-index: 1070 !important;
    top: calc(100% + 0.25rem) !important;
    left: 0 !important;
    margin: 0 !important;
    width: auto !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.input-group .flatpickr-calendar::before,
.input-group .flatpickr-calendar::after {
    display: none !important;
}

/* === Dropdown Caret Suppression === */
.dropdown-toggle::after,
.caret,
.label-selector .dropdown-toggle::after,
.setting-selector .dropdown-toggle::after,
.sort-selector .dropdown-toggle::after,
.page-size-selector .dropdown-toggle::after,
.option-menu-wrapper .dropdown-toggle::after {
    display: none !important;
}