/* Xavier PHP Login Script - Main Stylesheet */
/* Note: Theme variables (:root) are in themes.css and variables.css */
/* Note: Body and Navbar styles are in themes.css */

/* ── Global: Disable text selection on UI elements (mobile long-press fix) ── */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Allow text selection where users actually need it */
p,
h1, h2, h3, h4, h5, h6,
span,
li,
td, th,
blockquote,
pre, code,
article,
.post-content,
.post-card__body,
.result-snippet,
.result-title,
.board-description,
.guidelines,
.no-results p,
.text-secondary,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
.form-control,
.form-control-premium,
.search-input,
.reply-textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* Card Enhancements */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none;
    border-radius: 8px;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Button Styling */
.btn {
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Form Styling */
.form-control {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Alert Styling */
.alert {
    border-radius: 8px;
    border: none;
}

/* Badge Styling */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* Table Styling */
.table {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.table thead th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Sidebar (Admin) */
.sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar .nav-link {
    color: var(--text-primary);
    padding: 12px 20px;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: var(--bg-hover);
    border-left-color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--bg-tertiary);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        top: 0;
    }
    
    .table {
        font-size: 0.875rem;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* User Avatar */
.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-avatar-md {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.user-avatar-lg {
    width: 128px;
    height: 128px;
    border-radius: 50%;
}

/* Forum Specific Styles */
.forum-category {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.topic-row {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.topic-row:hover {
    background-color: var(--bg-hover);
}

.topic-row:last-child {
    border-bottom: none;
}

.sticky-topic {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
}

.locked-topic {
    opacity: 0.7;
}

/* Post Styling */
.post-author {
    background-color: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    color: var(--text-primary);
}

.post-content {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 20px;
    border-radius: 8px;
    min-height: 100px;
}

.post-signature {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* User Profile Link Styles */
.user-profile-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    position: relative;
    padding: 8px 15px !important;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.user-profile-link:hover {
    background: var(--bg-secondary) !important;
}

.user-avatar-img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(102, 126, 234, 0.5);
    flex-shrink: 0;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.username-display {
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message Badge Styles */
.message-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-primary);
    z-index: 10;
    pointer-events: none; /* Allow clicks through badge */
}

.notification-badge.pulse,
.message-badge.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* Hide username on mobile */
@media (max-width: 768px) {
    .username-display {
        display: none;
    }
}

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