/* style.css - Master Stylesheet */

/* --- GENERAL BODY --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    background-color: #f4f6f9;
    color: #333;
}

/* --- LAYOUT & CONTAINERS --- */
.header-wrapper, .logout-wrapper {
    max-width: 800px;
    margin: 0 auto;
}
.container { 
    max-width: 1100px; 
    margin: 0 auto; 
    background: white; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}
.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.col-left { flex: 2; min-width: 300px; }
.col-right { flex: 1; min-width: 300px; }

/* --- HEADERS & TEXT --- */
h1 { margin-bottom: 5px; color: #333; }
h2 { margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; font-size: 1.2em; color: #333; }
.subtitle { color: #666; margin-bottom: 20px; font-size: 0.9em; }
.back-link { display: inline-block; margin-bottom: 20px; color: #007bff; text-decoration: none; font-weight: bold; }

/* --- CARDS & BOXES --- */
.data-box { 
    background: #fff; 
    padding: 20px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
}
.pending-box { background-color: #fff3cd; border: 1px solid #ffeeba; padding: 10px; border-radius: 4px; margin-top: 5px; color: #856404; font-size: 0.9em; }
.warning-note { font-size: 0.9em; color: #666; font-style: italic; margin-bottom: 15px; }

/* --- ALERTS & MESSAGES --- */
.alert, .message-success, .message-error { padding: 15px; border-radius: 6px; margin-bottom: 20px; }
.alert-success, .message-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .message-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.remember-me-info { background-color: #e6f7ff; color: #0056b3; border: 1px solid #b3e0ff; padding: 8px 12px; border-radius: 4px; display: inline-block; margin-bottom: 15px; font-size: 0.9em; }
.compliance-warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; padding: 15px; margin-bottom: 20px; border-radius: 4px; max-width: 800px; margin: 0 auto 20px auto; }

/* --- FORMS --- */
.form-group { margin-bottom: 15px; }
label.field-label { font-weight: bold; display: block; margin-bottom: 5px; color: #555; }
input[type="text"], input[type="email"], input[type="date"], input[type="tel"], input[type="password"] {
    width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1em;
}
.btn-toggle { background: none; border: none; cursor: pointer; font-size: 1.2em; margin-left: -35px; vertical-align: middle; }

/* --- BUTTONS --- */
.btn-save { width: 100%; padding: 12px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1.1em; font-weight: bold; }
.btn-save:hover { background-color: #218838; }
.btn { padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9em; color: white; margin-right: 5px; }
.btn-approve { background-color: #28a745; }
.btn-reject { background-color: #dc3545; }
.logout-btn { display: inline-block; padding: 8px 15px; background-color: #6c757d; color: white; text-decoration: none; border-radius: 4px; font-size: 0.9em; }
.logout-btn:hover { background-color: #5a6268; }

/* --- TABS (Welcome Page) --- */
.tabs-container { background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden; max-width: 800px; margin: 20px auto; }
.tab-buttons { display: flex; border-bottom: 1px solid #eee; background: #fafafa; }
.tab-btn { flex: 1; padding: 15px; border: none; background: none; cursor: pointer; font-size: 1em; font-weight: 600; color: #555; transition: all 0.2s; border-bottom: 3px solid transparent; position: relative; }
.tab-btn:hover { background-color: #f0f0f0; color: #333; }
.tab-btn.active { border-bottom: 3px solid #007bff; color: #007bff; background: white; }
.tab-content { display: none; padding: 25px; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- ACTION LINKS (Welcome Page) --- */
.action-link { display: block; padding: 12px 15px; margin-bottom: 10px; background-color: #f8f9fa; border: 1px solid #e9ecef; border-radius: 6px; text-decoration: none; color: #333; font-weight: 500; transition: transform 0.1s, background-color 0.2s; }
.action-link:hover { background-color: #e2e6ea; transform: translateX(3px); }
.action-link.admin { border-left: 4px solid #dc3545; }
.action-link.primary { border-left: 4px solid #007bff; }

/* --- TABLES (Admin Page) --- */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; vertical-align: top; }
th { background-color: #f8f9fa; font-weight: bold; color: #555; }
tr:hover { background-color: #f1f1f1; }

/* --- BADGES --- */
.badge-main { background: red; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.8em; vertical-align: top; margin-left: 5px; }
.badge-pill { float:right; background:#dc3545; color:white; padding:2px 8px; border-radius:10px; font-size:0.8em; font-weight:bold; }
.badge-tfn { background: #e3f2fd; color: #0d47a1; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.badge-lic { background: #fff3e0; color: #e65100; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.badge-info { background: #e8f5e9; color: #1b5e20; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.pending-badge { background-color: #ffc107; color: #212529; padding: 2px 6px; border-radius: 4px; font-size: 0.7em; font-weight: bold; margin-left: 8px; vertical-align: middle; text-transform: uppercase; }

/* --- PROFILE SIDEBAR LABELS --- */
.info-row { margin-bottom: 10px; border-bottom: 1px dashed #eee; padding-bottom: 5px; }
.label-text { font-weight: bold; display: inline-block; width: 140px; color: #555; }
.file-status { display: inline-block; margin-left: 10px; font-size: 0.9em; }

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .main-container { flex-direction: column; }
    th:nth-child(3), td:nth-child(3) { display: none; } /* Hide Role col on mobile */
}

/* =========================================
   TIMESHEET SPECIFIC STYLES
   ========================================= */

.form-container, .week-selector, .status-box, .history-table, .log-container { 
    border: 1px solid #ccc; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    max-width: 800px; 
    background: white;
    margin-left: auto;  
    margin-right: auto; 
}
.status-box { background-color: #eef; }
.contractor-msg {
    background-color: #fff3cd; 
    border: 1px solid #ffeeba; 
    color: #856404;
    padding: 15px; 
    border-radius: 5px; 
    margin: 0 auto 20px auto; 
    max-width: 800px;
    font-size: 0.95em; 
    line-height: 1.5;
}
input.time-input { width: 100px; padding: 5px; }
input[type="number"] { width: 70px; }
select.job-id-input { width: 110px; padding: 5px; }
#grand_total { font-weight: bold; color: #007bff; }
button[value="submit_review"] { background-color: #007bff; }
button[value="submit_review"]:hover { background-color: #0069d9; }

@media screen and (max-width: 700px) {
    .form-container, .week-selector, .history-table, .log-container { padding: 10px; }
    .timesheet-table, .timesheet-table thead, .timesheet-table tbody, .timesheet-table th, .timesheet-table td, .timesheet-table tr { display: block; }
    .timesheet-table thead tr { position: absolute; top: -9999px; left: -9999px; }
    .timesheet-table tr { border: 1px solid #ccc; margin-bottom: 15px; border-radius: 4px; overflow: hidden; }
    .timesheet-table td { border: none; border-bottom: 1px solid #eee; position: relative; padding-left: 50%; text-align: right; }
    .timesheet-table td:before { content: attr(data-label); position: absolute; top: 10px; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; text-align: left; font-weight: bold; }
    input.time-input, input[type="number"], select.job-id-input { width: 95%; }
}

/* --- LOGIN & REGISTER PAGES --- */
.login-container { max-width: 400px; margin: 60px auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.login-container h2 { text-align: center; margin-bottom: 25px; border-bottom: none; }
.login-container button { width: 100%; margin-top: 10px; padding: 12px; font-size: 1.1em; background-color: #007bff; }
.login-container button:hover { background-color: #0056b3; }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.9em; color: #666; }

/* =========================================
   PROFILE PHOTO & FILE BROWSER
   ========================================= */
.avatar-container { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.avatar-preview { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 3px solid #ddd; background-color: #f0f0f0; }
.avatar-upload-box { flex: 1; }
@media (max-width: 600px) { .avatar-container { flex-direction: column; text-align: center; } }

ul.file-grid { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
ul.file-grid li { width: 150px; background: #fff; border: 1px solid #e9ecef; border-radius: 8px; padding: 15px; text-align: center; transition: transform 0.2s, box-shadow 0.2s; position: relative; display: flex; flex-direction: column; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
ul.file-grid li:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); border-color: #007bff; z-index: 10; }
.file-link { text-decoration: none; color: #333; display: flex; flex-direction: column; align-items: center; width: 100%; margin-bottom: 10px; flex-grow: 1; }
.item-icon { width: 80px; height: 80px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; font-size: 3.5em; object-fit: cover; border-radius: 4px; }
.item-icon.dir::before { content: '📁'; }
.item-icon.file::before { content: '📄'; }
.item-name { font-size: 0.9em; word-break: break-word; line-height: 1.3; color: #555; font-weight: 500; }
.get-link-btn { margin-top: auto; background-color: #17a2b8; color: white; border: none; padding: 6px 10px; border-radius: 4px; font-size: 0.8em; cursor: pointer; width: 100%; transition: background 0.2s; }
.get-link-btn:hover { background-color: #138496; }
.parent-link-item { width: 100% !important; height: auto !important; background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 15px; }
.parent-link-item:hover { transform: none !important; }
.parent-link { display: block; padding: 12px; background-color: #f8f9fa; border: 1px dashed #ccc; color: #555; text-align: center; border-radius: 6px; text-decoration: none; font-weight: bold; }
.parent-link:hover { background-color: #e2e6ea; color: #333; border-color: #adb5bd; }

/* =========================================
   USER ASSIGNMENT CHECKLIST
   ========================================= */
.user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; max-height: 400px; overflow-y: auto; padding: 10px; border: 1px solid #eee; border-radius: 4px; background: #fafafa; }
.user-list label { display: flex; align-items: center; padding: 8px; background: white; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; font-size: 0.9em; }
.user-list label:hover { background-color: #f0f8ff; border-color: #007bff; }
.user-list input[type="checkbox"] { margin-right: 8px; width: auto; }

/* =========================================
   FIREWALL MANAGER (Global)
   ========================================= */
table.firewall-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; margin-top: 10px; }
table.firewall-table th, table.firewall-table td { padding: 10px; border: 1px solid #ddd; text-align: left; word-break: break-word; }
table.firewall-table th { background: #f1f1f1; }
.ip-blocked { background-color: #ffe6e6; }
.ip-warning { background-color: #fffbf2; }
.status-2xx { color: green; font-weight: bold; }
.status-4xx { color: #d9534f; font-weight: bold; }
.status-5xx { color: #dc3545; font-weight: bold; }
.badge-safe { background: #e2e3e5; color: #383d41; padding: 4px 8px; border-radius: 4px; font-size: 0.85em; font-weight: bold; }
.badge-blocked { background: #343a40; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 0.85em; font-weight: bold; }
.actions-bar { margin-bottom: 15px; padding: 15px; background: #f8f9fa; border: 1px solid #ddd; border-radius: 5px; display: flex; justify-content: space-between; align-items: center; }
.btn-danger { background-color: #dc3545; color: white; padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; }
.btn-success { background-color: #28a745; color: white; padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; }
.chk-big { transform: scale(1.5); cursor: pointer; }
.tab-container { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 20px; }
.tab-button { padding: 10px 20px; cursor: pointer; border: none; background: none; font-size: 16px; font-weight: bold; color: #666; border-bottom: 3px solid transparent; }
.tab-button:hover { color: #000; }
.tab-button.active { color: #007bff; border-bottom: 3px solid #007bff; }
#analysis.tab-content, #blocked.tab-content { display: none; padding: 0; border: none; box-shadow: none; }
#analysis.active, #blocked.active { display: block; }

/* =========================================
   FORENSIC MODAL STYLES (New)
   ========================================= */
.modal { display: block; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }
.modal-content { background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 90%; max-width: 900px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-family: monospace; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; text-decoration: none; cursor: pointer; }
.close-btn:hover { color: #000; }
.cmd-output { background: #1e1e1e; color: #d4d4d4; padding: 15px; overflow-x: auto; border-radius: 4px; border: 1px solid #444; max-height: 400px; white-space: pre; }
.ip-link { text-decoration: none; color: inherit; border-bottom: 1px dashed #666; cursor: help; }
.ip-link:hover { background-color: #ffffcc; color: #000; border-bottom: 1px solid #000; }

/* =========================================
   FIREWALL MOBILE FIXES (New)
   ========================================= */
/* 1. Force columns to shrink to fit content (e.g. IP Address) */
.fit-content { width: 1%; white-space: nowrap; }

/* 2. Prevent Dates from wrapping to two lines */
.no-wrap { white-space: nowrap; }

@media screen and (max-width: 768px) {
    /* Container padding adjustment */
    .container { width: 98%; padding: 5px; }
    .firewall-table { font-size: 12px; }
    .firewall-table th, .firewall-table td { padding: 6px 3px; }

    /* Show Failed column, hide others */
    table.firewall-table th:nth-child(3), table.firewall-table td:nth-child(3) { display: table-cell !important; width: 15%; font-weight: bold; background-color: #fff3cd; text-align: center; vertical-align: middle; }
    table.firewall-table th:nth-child(4), table.firewall-table td:nth-child(4), 
    table.firewall-table th:nth-child(5), table.firewall-table td:nth-child(5) { display: none; }
    
    /* Bigger buttons */
    .actions-bar { flex-direction: column; gap: 10px; }
    .actions-bar button { width: 100%; padding: 12px; font-size: 1.1em; }
    
    /* Truncate the "Request" column on mobile */
    .truncate-mobile {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block; 
    }
}