/*
 * PeRP! Custom Styles - Bootstrap 5 First Approach
 *
 * This file contains ONLY custom styles specific to PeRP!
 * All standard UI elements use Bootstrap 5 classes directly in HTML
 */

/* ============================================
   GLOBAL STYLES
   ============================================ */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > .container {
    flex: 1;
}

/* Add top padding when navbar is present */
body.has-sticky-header {
    padding-top: 60px; /* Adjusted for Bootstrap navbar height */
}

/* ============================================
   BOOTSTRAP NAVBAR ENHANCEMENTS
   ============================================ */

/* Custom navbar styling */
.navbar .nav-link {
    color: white !important;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Context selector in navbar */
.navbar .form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* Badge positioning for navbar icons */
.navbar .position-relative .badge {
    font-size: 0.7rem;
}

/* Remove default dropdown caret since we're using an icon */
.navbar .dropdown-toggle::after {
    display: none;
}

/* ============================================
   DASHBOARD & MODULE NAVIGATION
   ============================================ */

.dashboard-logo {
    text-align: center;
    margin: 40px 0;
}

.dashboard-logo img {
    max-width: 200px;
    width: 100%;
    height: auto;
}

/* Modules Navigation Grid */
.modules-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.module-nav-item {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.module-nav-item:hover {
    background-color: #e7f3ff;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.module-nav-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.module-nav-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}

/* Add Module Button */
.module-nav-item.add-module {
    background-color: #f0f8f0;
    border: 2px dashed #6c757d;
    color: #6c757d;
}

.module-nav-item.add-module:hover {
    background-color: #e8f5e8;
    border-color: #28a745;
    color: #28a745;
}

.add-module-icon {
    font-size: 3em !important;
    font-weight: bold;
}

/* ============================================
   TRASH VIEW
   ============================================ */

.trash-view {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    margin-top: 20px;
}

.trash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.trash-header h2 {
    margin: 0;
    color: #2c3e50;
}

.trash-actions {
    display: flex;
    gap: 10px;
}

.trash-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.trash-empty p:first-child {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.trash-empty-subtitle {
    font-size: 0.95em;
    color: #adb5bd;
}

/* ============================================
   MODULE MANAGEMENT
   ============================================ */

.modules-section {
    padding-top: 30px;
}

.module-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.module-manager-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.module-card {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.module-card.enabled {
    border-color: #28a745;
    background-color: #f8fff8;
}

.module-card .module-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.module-version {
    font-size: 0.85em;
    color: #6c757d;
}

/* ============================================
   ERROR PAGES
   ============================================ */

.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-icon {
    font-size: 6em;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-in;
}

.error-code {
    font-size: 5em;
    font-weight: bold;
    color: #2c3e50;
    margin: 0;
    line-height: 1;
}

.error-title {
    font-size: 2em;
    color: #2c3e50;
    margin: 20px 0 10px 0;
}

.error-message {
    font-size: 1.2em;
    color: #6c757d;
    margin: 10px 0 20px 0;
}

.error-detail {
    font-size: 0.95em;
    color: #adb5bd;
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    word-break: break-word;
}

.error-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

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

/* ============================================
   PROFILE VIEW & SETTINGS
   ============================================ */

.profile-view,
.profile-settings {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    margin-top: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.profile-header h2 {
    margin: 0;
    color: #2c3e50;
}

.profile-actions {
    display: flex;
    gap: 10px;
}

.profile-info-card {
    display: flex;
    gap: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img,
.avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

.profile-details {
    flex-grow: 1;
}

.profile-details h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.profile-username {
    font-size: 1.1em;
    margin-bottom: 15px;
}

.profile-bio {
    font-style: italic;
    color: #6c757d;
    margin-bottom: 15px;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.profile-fields {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.profile-fields .mb-3 {
    padding: 8px 0;
}

/* Profile Settings */
.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.settings-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.settings-section form {
    background-color: white;
    padding: 20px;
    border-radius: 6px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .modules-nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .module-nav-item {
        padding: 15px;
        min-height: 100px;
    }

    .module-nav-icon {
        font-size: 2em;
    }

    .trash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .trash-actions {
        width: 100%;
        flex-direction: column;
    }

    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .profile-actions {
        width: 100%;
        flex-direction: column;
    }

    .profile-info-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-view,
    .profile-settings {
        padding: 20px 15px;
    }
}

/* Blocked Users Page */
.blocked-users-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.page-header h2 {
    margin: 0;
    font-size: 28px;
    color: #333;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.blocked-users-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
}

@media (max-width: 991.98px) {
    body.has-sticky-header {
        padding-top: 56px; /* Standard Bootstrap mobile navbar height */
    }

    /* Mobile: Add spacing between collapsed navbar items */
    .navbar-nav .nav-item {
        padding: 0.25rem 0;
    }

    .navbar-nav .nav-item > div {
        padding: 0.5rem 0;
    }
}

@media (max-width: 480px) {

    .modules-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

[data-bs-theme="dark"] body {
    background-color: #1a1d20;
    color: #e9ecef;
}

/* Module Navigation Cards in Dark Mode */
[data-bs-theme="dark"] .module-nav-item {
    background-color: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .module-nav-item:hover {
    background-color: #1e3a5f;
    border-color: #3498db;
}

[data-bs-theme="dark"] .module-nav-icon {
    color: #e9ecef;
}

[data-bs-theme="dark"] .module-nav-name {
    color: #e9ecef;
}

/* Add Module Button in Dark Mode */
[data-bs-theme="dark"] .module-nav-item.add-module {
    background-color: #1e2d1e;
    border-color: #6c757d;
    color: #adb5bd;
}

[data-bs-theme="dark"] .module-nav-item.add-module:hover {
    background-color: #2d3e2d;
    border-color: #28a745;
    color: #28a745;
}

/* User Dropdown Menu in Dark Mode */
[data-bs-theme="dark"] .user-dropdown-menu {
    background-color: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .user-dropdown-menu a {
    color: #e9ecef;
}

[data-bs-theme="dark"] .user-dropdown-menu a:hover {
    background-color: #1a1d20;
}

[data-bs-theme="dark"] .dropdown-divider {
    background-color: #495057;
}

/* Trash View in Dark Mode */
[data-bs-theme="dark"] .trash-view {
    background-color: #2b3035;
    color: #e9ecef;
}

[data-bs-theme="dark"] .trash-header h2 {
    color: #e9ecef;
}

[data-bs-theme="dark"] .trash-header {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .trash-empty {
    color: #adb5bd;
}

[data-bs-theme="dark"] .trash-empty-subtitle {
    color: #6c757d;
}

/* Module Management in Dark Mode */
[data-bs-theme="dark"] .module-card {
    background-color: #2b3035;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .module-card.enabled {
    background-color: #1e2d1e;
    border-color: #28a745;
}

[data-bs-theme="dark"] .module-version {
    color: #adb5bd;
}

/* Profile View in Dark Mode */
[data-bs-theme="dark"] .profile-view,
[data-bs-theme="dark"] .profile-settings {
    background-color: #2b3035;
    color: #e9ecef;
}

[data-bs-theme="dark"] .profile-header {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .profile-header h2 {
    color: #e9ecef;
}

[data-bs-theme="dark"] .module-manager-header {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .module-manager-header h3 {
    color: #e9ecef;
}

[data-bs-theme="dark"] .profile-info-card {
    background-color: #1a1d20;
}

[data-bs-theme="dark"] .profile-details h3 {
    color: #e9ecef;
}

[data-bs-theme="dark"] .profile-bio {
    background-color: #2b3035;
    color: #adb5bd;
    border-left-color: #3498db;
}

[data-bs-theme="dark"] .profile-fields {
    border-top-color: #495057;
}

[data-bs-theme="dark"] .avatar-placeholder {
    background-color: #495057;
}

/* Settings Sections in Dark Mode */
[data-bs-theme="dark"] .settings-section {
    background-color: #1a1d20;
}

/* Error Pages in Dark Mode */
[data-bs-theme="dark"] .error-code {
    color: #e9ecef;
}

[data-bs-theme="dark"] .error-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .error-message {
    color: #adb5bd;
}

[data-bs-theme="dark"] .error-detail {
    background-color: #1a1d20;
    color: #ced4da;
    border: 1px solid #495057;
}

[data-bs-theme="dark"] .settings-section h4 {
    color: #e9ecef;
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .settings-section form {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .app-footer {
    background-color: #1a1d20;
    border-top-color: #495057;
}

/* ============================================
   APP FOOTER
   ============================================ */

.app-footer {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.app-footer a {
    color: #6c757d;
}

.app-footer a:hover {
    color: #0969da;
}

/* ============================================
   AUTHENTICATION PAGES (Sign In / Sign Up)
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.auth-container {
    flex: 1;
    display: flex;
}

/* Left Side: Info Panel */
.auth-info {
    flex: 0 0 45%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.auth-info-content {
    max-width: 500px;
}

.auth-info h1 {
    color: white;
}

.auth-info .lead {
    color: white !important;
    font-weight: 500;
}

.features-list {
    margin-top: 3rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    color: rgba(255, 255, 255, 0.95);
}

.feature-item i {
    flex-shrink: 0;
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.feature-item strong {
    color: white;
    display: block;
    margin-bottom: 0.25rem;
}

.feature-item .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Right Side: Form Container */
.auth-form-container {
    flex: 0 0 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background-color: #ffffff;
}

.auth-form-content {
    width: 100%;
    max-width: 450px;
}

/* Footer */
.auth-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1.5rem 0;
}

.auth-footer a {
    color: #6c757d;
}

.auth-footer a:hover {
    color: #0969da;
}

/* Responsive Design */
@media (max-width: 991px) {
    .auth-container {
        flex-direction: column;
        min-height: auto;
    }

    .auth-info {
        flex: 0 0 auto;
        padding: 2rem 1.5rem;
    }

    .auth-info-content {
        max-width: 100%;
    }

    .features-list {
        margin-top: 2rem;
    }

    .auth-form-container {
        flex: 0 0 auto;
        padding: 2rem 1.5rem 3rem;
    }

    .auth-footer {
        margin-top: 0;
    }
}

@media (max-width: 575px) {
    .auth-info {
        padding: 1.5rem 1rem;
    }

    .auth-form-container {
        padding: 1.5rem 1rem 2rem;
    }

    .feature-item {
        font-size: 0.9rem;
    }

    .feature-item i {
        font-size: 1.2rem;
    }
}

/* ============================================
   ROLE CHIPS (Member Management)
   ============================================ */

.member-roles {
    margin-top: 0.5rem;
}

/* Organization role chips - red/danger theme */
.role-chip-org {
    background-color: #dc3545;
    color: white;
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Module role chips - blue/info theme */
.role-chip-module {
    background-color: #0d6efd;
    color: white;
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Add role button styling */
.btn-add-role {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

/* Role option in add role modal */
.role-option {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.role-option:hover {
    background-color: #f8f9fa;
}
