/* ==========================================================================
   1. GENERAL BODY & LAYOUT STYLES
   ========================================================================== */
html, body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #eee;
}

body {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    z-index: 0;
    background: linear-gradient(135deg, #2b2b2b 0%, #444 50%, #2b2b2b 100%);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: grayscale(100%);
    opacity: 0.8;
    z-index: -1;
}

.main-content-wrapper {
    flex-grow: 1;
    padding-bottom: 90px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.image-glow {
    position: fixed;
    left: -3%;
    bottom: 0;
    filter: drop-shadow(0px 0px 12px gray);
    width: 570px;
    max-width: 40%;
    z-index: 0;
    pointer-events: none;
}
.image-glow-flipped {
    position: fixed;
    right: -3%;
    bottom: 0;
    transform: scaleX(-1);
    filter: drop-shadow(0px 0px 12px gray);
    width: 570px;
    max-width: 40%;
    z-index: 0;
    pointer-events: none;
}


/* ==========================================================================
   2. NEW COMPANION CONTAINER & TABS
   ========================================================================== */
.companion-container {
    width: 89%;
    max-width: 950px; /* Matched original container size */
    margin: 20px auto;
    margin-top: 1in;
    background-color: #222;
    padding: 20px 30px;
    border-radius: 12px;
    border: 2px solid black;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

.tab-navigation {
    display: flex;
    border-bottom: 2px solid black;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow tabs to wrap on small screens */
}

.tab-button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: #ccc;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    flex-grow: 1; /* Make buttons share space */
    text-align: center;
}

.tab-button:hover {
    background-color: #333;
    color: #fff;
}

.tab-button.active {
    color: #00a8ff;
    border-bottom: 3px solid #00a8ff;
}

.tab-pane {
    display: none; /* All panes are hidden by default */
}

.tab-pane.active {
    display: block; /* Only the active pane is shown */
}


/* ==========================================================================
   3. SHARED COMPONENT STYLES (Used across multiple tabs)
   ========================================================================== */
.companion-container .script-title {
    font-size: 2.2rem;
    font-weight: bold;
    position: relative;
    margin-top: 0;
    margin-bottom: 20px;
    color: #00a8ff;
    -webkit-text-stroke: 1px black;
    text-shadow: 0px 0px 5px #00a8ff, 0px 0px 4px #0077cc;
    text-align: center;
}

.action-buttons-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid #000;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-width: 150px;
    text-align: center;
}
.action-btn.fetch-btn { background-color: #28a745; color: #000; }
.action-btn.fetch-btn:hover { background-color: #218838; }
.action-btn.discord-btn { background-color: #5865F2; color: #fff; }
.action-btn.discord-btn:hover { background-color: #4a54d6; }
.action-btn.save-btn { background-color: #00a8ff; color: #222; }
.action-btn.save-btn:hover { background-color: #0086d1; }
.action-btn.download-btn { background-color: #00a8ff; color: #222; }
.action-btn.download-btn:hover { background-color: #0086d1; }

.error-message {
    color: #ff4d4d;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
    min-height: 1.2em;
}

.modal-action-area {
    display: flex; /* Use flexbox for alignment */
    justify-content: center; /* Center the button horizontally */
    padding-top: 20px;
    flex-shrink: 0;
}


/* ==========================================================================
   4. TAB-SPECIFIC STYLES
   ========================================================================== */

/* --- Styles for Tab 1: Personal Target Finder --- */
.target-finder-container { text-align: center; }
.target-finder-container p { margin-bottom: 15px; }
.results-inline-status { font-size: 0.9rem; margin-top: 10px; color: #ffcc00; min-height: 1.2em; }
.note { text-align: center; font-size: 0.9rem; color: #f39c12; padding: 0px; margin-top: 40px; }
.note p { font-weight: bold; font-size: 0.9em; margin-top: -40px;}

/* --- Styles for Tab 2 (Public Lookup) & 3 (Leader Dashboard) --- */
.input-group { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; align-items: center; }
.input-field { width: 100%; max-width: 320px; display: flex; flex-direction: column; text-align: left; }
.companion-container label { font-weight: 600; margin-bottom: 6px; color: #007acc; font-size: 1.1rem; text-align: center; }
.companion-container input[type="text"],
.companion-container select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1.5px solid #007acc;
    background-color: #121212;
    color: #eee;
    font-size: 1rem;
    height: 39px;
    box-sizing: border-box;
    width: 100%;
}
.companion-container select { cursor: pointer; }
.companion-container input[type="text"]:focus,
.companion-container select:focus {
    outline: none;
    border-color: #00b0ff;
    box-shadow: 0 0 8px #00b0ff;
}
.input-divider { color: #ccc; font-weight: bold; margin: 5px 0; }


/* ==========================================================================
   5. SHARED MODAL & SPINNER STYLES
   ========================================================================== */
.modal-overlay {
    position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.8);
    display: flex;justify-content: center;align-items: center;z-index: 1500;visibility: hidden;opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;padding: 20px;box-sizing: border-box;
}
.modal-overlay.visible {visibility: visible;opacity: 1;}
.modal-content {
    background-color: #222;border-radius: 12px;box-shadow: 0 0 25px rgba(0, 168, 255, 0.6);
    padding: 30px;width: 90%;max-width: 1000px;max-height: 90vh;overflow-y: auto;position: relative;
    transform: translateY(20px);opacity: 0;transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    display: flex; flex-direction: column;
}
.modal-overlay.visible .modal-content {transform: translateY(0);opacity: 1;}
.modal-close-btn {
    position: absolute;top: 15px;right: 15px;background: none;border: none;
    font-size: 1.8rem;color: #00a8ff;cursor: pointer;z-index: 10;
}
.modal-close-btn:hover {color: #00e0ff;}
.modal-title {color: #00a8ff;font-size: 1.8rem;margin-top: 0;margin-bottom: 20px;text-align: center;}
.modal-summary {margin-bottom: 50px;font-size: 1.1rem;color: #ccc;text-align: center;}
.modal-summary span {font-weight: bold;color: #eee;}
.modal-table-container {
    max-height: calc(90vh - 280px);
    overflow-y: auto;border: 1px solid #007acc;border-radius: 8px;margin-top: -36px;
    flex-grow: 1;
}
.modal-table {width: 100%;border-collapse: collapse;margin: 0;background-color: #1a1a1a;}
.modal-table thead th {
    background-color: #007acc;color: #000;padding: 10px 15px;text-align: left;
    border: 1px solid #005f99;position: sticky;top: 0;z-index: 10;
}
.modal-table tbody tr:nth-child(even) {background-color: #222;}
.modal-table tbody tr:nth-child(odd) {background-color: #2b2b2b;}
.modal-table tbody td {padding: 8px 15px;border: 1px solid #333;color: #eee;font-size: 0.9rem;text-align: left;}
.modal-table tbody tr:hover {background-color: #3a3a3a;}
.loading-overlay {
    position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.7);
    display: flex;justify-content: center;align-items: center;z-index: 2000;backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);visibility: hidden;opacity: 0;transition: visibility 0s, opacity 0.3s ease-in-out;
}
.loading-overlay.visible {visibility: visible;opacity: 1;}
.spinner {
    border: 8px solid #333;border-top: 8px solid #00a8ff;border-radius: 50%;
    width: 60px;height: 60px;animation: spin 1s linear infinite;
}
@keyframes spin {0% { transform: rotate(0deg); }100% { transform: rotate(360deg); }}

/* DELETE previous target grid styles and REPLACE with this FINAL, COLOR-CORRECTED version */

.target-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding-top: 10px;
	padding-left: 10px;
	padding-right: 10px;
	padding-bottom: 10px;
}

.target-card {
    background-color: #2a2a2e; /* Card background color from your crime cards */
    border: 1px solid #3a3a40; /* Border color from your crime cards */
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: none; /* Removed the default box-shadow for a cleaner look */
}

.target-card-header {
    background-color: #00a8ff; /* Header background color from your crime cards */
    color: #1e1e1e; /* Darker text color for contrast on blue */
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 2px solid #1e1e1e; /* Stronger border for separation */
}

.target-card-body {
    padding: 10px 15px;
    flex-grow: 1;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid #444; /* Lighter border from your crime cards */
}

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

.stat-row span:first-child {
    color: #bbb; /* Label color from your crime cards */
    font-weight: normal; /* Labels are not bold */
}

.stat-row span:last-child {
    color: #f0f0f0; /* Value color */
    font-weight: bold;
}

/* Specific styling for the Status badge to match the crime card's value styling */
.stat-row .status-badge {
    padding: 0; /* Remove padding as it's not a standalone badge now */
    border-radius: 0; /* Remove border-radius */
    font-size: 0.95rem; /* Match parent font size */
    font-weight: bold;
    text-transform: capitalize; /* "Okay" looks better capitalized */
    background-color: transparent; /* Make background transparent */
    color: inherit; /* Use inherited color, which will be set by JS based on status */
    display: inline; /* Keep it inline with the label */
    width: auto; /* Remove fixed width */
    text-align: right;
}

.target-card-footer {
    padding: 15px;
    background-color: #2a2a2e; /* Consistent with card body, or can be adjusted */
    border-top: 1px solid #3a3a3a;
}

.attack-button {
    background-color: #0d6efd; /* Your standard blue button */
    color: white;
    padding: 5px 0px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    border: none;
    width: 100%;
    display: block;
    box-sizing: border-box;
    text-align: center;
}

.attack-button:hover {
    background-color: #0b5ed7;
}

/* ADD THIS CSS to fair-fight-companion.css to fix table column widths */

/* This forces the table to respect the widths we define */
.modal-table {
    table-layout: fixed;
    width: 100%;
}

/* Set a specific width for the "Fair Fight" column (the 2nd column) */
.modal-table th:nth-child(2),
.modal-table td:nth-child(2) {
    width: 120px; 
    text-align: center;
}

/* Set a specific width for the "Est. Stats" column (the 3rd column) */
.modal-table th:nth-child(3),
.modal-table td:nth-child(3) {
    width: 120px;
    text-align: right;
}

/* The first column ("Name") will automatically take up the remaining space */
.modal-table th:nth-child(1),
.modal-table td:nth-child(1) {
    width: 100px;
}

/* ==========================================================================
   6. RESPONSIVE MEDIA
   ========================================================================== */
@media (max-width: 768px) {
    .companion-container { padding: 10px 15px; width: 90%; margin-top: 122px; }
    .image-glow, .image-glow-flipped { display: none !important; }
    .modal-content { width: 95% !important; max-width: 100% !important; padding: 15px !important; max-height: calc(100vh - 100px) !important; margin-top: 93px !important; }
    .modal-title { font-size: 1.5rem; }
    .modal-summary { font-size: 0.9rem; }
    .modal-table-container { overflow-x: auto !important; }
    .modal-table thead th, .modal-table tbody td { padding: 5px 8px !important; font-size: 0.75rem !important; white-space: nowrap; }

  header #headerEditProfileBtn {
    display: none !important;
  }


}




@media (max-width: 480px) {
    .companion-container { padding: 10px; }
    .companion-container .script-title { font-size: 1.8rem; }
    .action-buttons-container .action-btn { min-width: unset; width: 100%; }
    .modal-content { padding: 10px !important; }
    .modal-table thead th, .modal-table tbody td { font-size: 0.7rem !important; }
}
/* Hide background images on small laptop screens */
@media screen and (max-width: 1366px) {
    .image-glow,
    .image-glow-flipped {
        display: none;
    }
}