/* AdminLTE v4 customizations rewritten from v3 rules */

/* 1. Root Variables
// =================================================================*/
:root {
  --brand-red: #E30613; /* Official Brand Red from Logo */
  --brand-red-darker: #c00511;
  --brand-dark-blue: #2C3E50; /* A very dark, almost black blue for text and sidebars */
  --brand-gray: #7F8C8D; /* Neutral Gray */
  --brand-primary-blue: #3498DB;
  --brand-secondary-blue: #2980B9;

  /* Sober, professional colors for dashboard cards - Unified to a single professional blue */
  --color-card-default: var(--brand-primary-blue);

  /* Overriding Bootstrap's default theme colors for a sober, professional look */
  --bs-primary: var(--brand-red); /* The only strong accent color is the brand's red */
  --bs-secondary: #6c757d;
  --bs-success: #218838; /* A more desaturated green, for alerts only */
  --bs-info: var(--brand-secondary-blue); /* Using the new professional blue */
  --bs-warning: #d39e00; /* A more desaturated yellow, for alerts only */
  --bs-danger: var(--brand-red);
  --bs-light: #f8f9fa;
  --bs-dark: var(--brand-dark-blue);

  --bs-body-color: #343a40;
  --bs-body-bg: #f4f6f9;
}

/* 2. Global Styles
// =================================================================*/
.btn {
  border-radius: 0.375rem; /* Standardize button corner rounding */
}

.card {
  border: 1px solid #dee2e6; /* Add a subtle border */
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); /* A lighter, more modern shadow */
  transition: all 0.2s ease-in-out; /* Transition all properties for smooth hover */
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* A slightly more pronounced shadow on hover */
  transform: translateY(-2px); /* Add a slight lift effect */
}

.text-primary {
    color: var(--brand-red) !important;
}

/* 3. Layout Components
// =================================================================*/

/* Sidebar Customization */
.app-sidebar {
  background-color: var(--brand-dark-blue) !important;
 
}

.sidebar-brand {
  background-color: #FFFFFF;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active,
.app-sidebar .menu-open > .nav-link {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.app-sidebar .nav-link .nav-icon {
  color: rgba(255, 255, 255, 0.75);
}

.app-sidebar .nav-link.active .nav-icon {
  color: #ffffff;
}

.app-sidebar .nav-link:hover .nav-icon {
  color: #ffffff;
}

/* Navbar Customization */
.app-header {
  border-bottom: 1px solid #dee2e6;
}


/* 4. Page-Specific Styles
// =================================================================*/

/* Dashboard Card Colors */
.text-color-individu,
.text-color-compagnie,
.text-color-adresse { 
  color: var(--color-card-default); 
}

.login-visual-pane {
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.login-visual-pane .display-4 {
  font-weight: 600;
}
.form-control:focus {
border-color: var(--brand-red);
box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, 0.25);
}
.form-check-input:checked {
  background-color: var(--brand-red);
  border-color: var(--brand-red);
}
.form-check-input:focus {
border-color: var(--brand-red);
box-shadow: 0 0 0 0.25rem rgba(227, 6, 19, 0.25);
}
.btn-brand {
background-color: var(--brand-red);
border-color: var(--brand-red);
color: #ffffff !important;
}
.btn-brand:hover, .btn-brand:focus {
background-color: var(--brand-red-darker);
border-color: var(--brand-red-darker);
color: #ffffff !important;
}
.login-card-body a {
  color: var(--bs-secondary);
  text-decoration: none;
}
.login-card-body a:hover {
  color: #000;
}
.social-auth-links .btn {
display: flex;
align-items: center;
justify-content: center;
}
.social-auth-links .btn img {
margin-right: 0.75rem;
}
.form-group {
  margin-bottom: 1rem;
}
.validation-placeholder {
  height: 1.25rem; /* Reserve space for one line of text */
}

/* Definition List styling for c-client-admin.php */
.dl-horizontal-bordered dt {
  font-weight: 600;
}
.dl-horizontal-bordered dd {
  padding-left: 1rem;
  margin-bottom: .5rem;
}
@media (min-width: 576px) {
  .dl-horizontal-bordered .row > dt {
    text-align: right;
  }
  .dl-horizontal-bordered .row {
    border-bottom: 1px solid #dee2e6;
    padding-top: .75rem;
    padding-bottom: .75rem;
  }
  .dl-horizontal-bordered .row:nth-of-type(odd) {
    background-color: rgba(0,0,0,.025);
  }
}


/* Loading spinner overlay */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.spinner-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: white;
}

/* Styles for PDF/Print Export */
@media print {
    body.print-mode .app-wrapper > :not(.app-main),
    body.print-mode .app-main > :not(.app-content),
    body.print-mode .app-content-header,
    body.print-mode .btn-toolbar,
    body.print-mode #inspector {
        display: none !important;
    }

    body.print-mode #graph-container-col {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    body.print-mode #cy {
        border: none !important;
        height: 90vh !important; /* Make it fill the page */
    }
}

/* 5. Component-Specific Fixes
// =================================================================*/

/* Fix for dropdown menus being overlapped by other elements in d-dossiers.php */
.card .dropdown-menu {
    z-index: 1030; /* Bootstrap's dropdown z-index is 1000. This ensures it's above other cards, especially with hover transforms. */
}

/* Align dropdown menus inside cards to the right */
.card .dropdown .dropdown-menu {
    left: auto !important;
    right: 0 !important;
}

/* Styles for p-prelocation.php */
.application-card { border: 1px solid #e5e7eb; border-radius: 0.5rem; background-color: #fff; box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05); margin-bottom: 1.5rem; transition: all 0.3s ease-in-out; }
.application-card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.card-main-content { padding: 1.5rem; }
.card-footer-actions { background-color: #f9fafb; padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; align-items: center; }
.applicant-info { font-size: 1.1rem; font-weight: 600; }
.applicant-info .email { font-size: 0.85rem; color: #6b7280; font-weight: 400; }
.property-info { font-size: 0.9rem; color: #6b7280; }
.empty-state { text-align: center; padding: 3rem; background-color: #fff; border: 2px dashed #d1d5db; border-radius: 0.5rem; transition: opacity 0.3s ease-in-out; }
.empty-state.hidden { display: none !important; }
.table-wrapper { border: 1px solid #e5e7eb; border-radius: 0.5rem; background-color: #fff; box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05); overflow: hidden;}
.filter-controls { display: flex; gap: 1rem; }

/* Custom styles for form inputs on the dashboard to match the application form aesthetic */
#sendApplicationForm .form-control:focus,
#sendApplicationForm .form-select:focus,
#addPropertyFormAjax .form-control:focus {
    border-color: #007aff; /* Apple Blue */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    outline: none;
}

/* Add left padding to submenu items to indent them */
.nav-treeview .nav-link {
  padding-left: 30px;
}

/* Style for the discreet address search button in reports */
.btn-link-discret {
    background: none;
    border: none;
    color: var(--brand-gray); /* Sober, non-intrusive color */
    padding: 0 0.25rem;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    vertical-align: middle; /* To align well with text */
}

.btn-link-discret:hover {
    color: var(--brand-red); /* Brand color on hover */
    transform: scale(1.2); /* Enlarge icon for interactive effect */
}

.btn-link-discret:focus {
    outline: none;
    box-shadow: none;
}

#confirm-and-pay-btn:disabled {
  background-color: var(--brand-red-darker);
  border-color: var(--brand-red-darker);
  cursor: not-allowed;
  opacity: 0.65;
}

/* 6. Styles for Moteur d'Analyse Relationnelle (d-search-enhancement.php)
// =================================================================*/
.dse-header { text-align: center; margin-bottom: 2rem; }
.dse-header h1 { color: var(--brand-dark-blue); }
.dse-search-form { display: flex; margin-bottom: 1rem; }
.dse-search-input { flex-grow: 1; padding: 0.75rem; border: 1px solid #dee2e6; border-radius: 0.25rem 0 0 0.25rem; font-size: 1rem; }
.dse-search-button {
    background-color: var(--brand-primary-blue); color: white; border: none;
    padding: 0.75rem 1.5rem; border-radius: 0 0.25rem 0.25rem 0;
    cursor: pointer; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem;
    transition: background-color 0.2s;
}
.dse-search-button:hover:not(:disabled) { background-color: var(--brand-secondary-blue); }
.dse-search-button:disabled { background-color: var(--brand-gray); cursor: not-allowed; }
.dse-loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-left-color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: dse-spin 1s linear infinite;
}
@keyframes dse-spin { to { transform: rotate(360deg); } }
.dse-progress-container { display: none; margin-bottom: 1rem; }
.dse-progress-bar-container { background-color: #e9ecef; border-radius: 0.25rem; }
.dse-progress-bar {
    background-color: var(--bs-success); color: white; text-align: center;
    line-height: 1.5rem; border-radius: 0.25rem;
    width: 0%; transition: width 0.4s ease;
}
.dse-report-container { background-color: #ffffff; border: 1px solid #dee2e6; padding: 1.5rem; border-radius: 0.25rem; margin-bottom: 1.5rem; }
.dse-results-container { display: flex; flex-direction: column; gap: 1rem; }
.dse-status-message { text-align: center; color: var(--brand-gray); padding: 2rem; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 0.25rem; }
.dse-error-message { color: var(--bs-danger); font-weight: bold; }

.dse-profile-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-left: 5px solid var(--brand-primary-blue);
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}
.dse-unconfirmed-profile {
    border-left-color: var(--brand-gray);
    background-color: #f8f9fa;
}
.dse-unconfirmed-profile .dse-deepen-button {
    background-color: var(--brand-gray);
    cursor: not-allowed;
}
.dse-profile-title { margin-top: 0; color: #333; }
.dse-evidence-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.dse-evidence-item {
    background-color: #e9ecef;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.dse-evidence-item:hover { background-color: #ced4da; }
.dse-deepen-button {
    background-color: var(--bs-success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    margin-top: 1rem;
    font-weight: bold;
    transition: background-color 0.2s;
}
.dse-deepen-button:hover:not(:disabled) { background-color: #218838; }

.dse-key-themes {
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    font-size: 0.9rem;
}
.dse-theme-tag {
    display: inline-block;
    background-color: var(--brand-primary-blue);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    margin: 0.2rem;
    font-size: 0.85rem;
}

.dse-final-report-text {
    white-space: pre-wrap;
    background-color: #fdfdfd;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 4px;
}
.dse-final-report-text h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--brand-primary-blue);
    border-bottom: 2px solid var(--brand-primary-blue);
    padding-bottom: 0.3rem;
}

.dse-result-card { background-color: #ffffff; border: 1px solid #dee2e6; padding: 1.5rem; border-radius: 0.25rem; }
.dse-result-title { margin-top: 0; }
.dse-result-link { color: var(--brand-primary-blue); text-decoration: none; display: block; margin-bottom: 0.5rem; word-break: break-all; }
.dse-result-link:hover { text-decoration: underline; }
.dse-ai-analysis { margin-top: 1rem; border-top: 1px solid #dee2e6; padding-top: 1rem; }
.dse-ai-header { display: flex; justify-content: space-between; align-items: center; font-weight: bold; margin-bottom: 0.5rem; }
.dse-correlation-score { padding: 0.25rem 0.5rem; border-radius: 0.25rem; color: white; }
.dse-score-high { background-color: var(--bs-success); }
.dse-score-medium { background-color: var(--bs-warning); color: var(--bs-body-color); }
.dse-score-low { background-color: var(--bs-secondary); }
.dse-ai-justification { font-style: italic; color: var(--brand-gray); font-size: 0.9rem; }
.dse-ai-summary { margin-bottom: 0.5rem; }
.dse-ai-analysis h5 { margin-bottom: 0.5rem; }
.dse-ai-analysis ul { margin-top: 0; padding-left: 1.5rem; }
.dse-ai-analysis ul li { color: var(--bs-danger); }

/* Adjust layout for mobile to ensure tabs are accessible */
@media (max-width: 767.98px) {
    .login-visual-pane {
        padding: 2rem !important;
        min-height: auto !important;
    }
}
