/* =========================================================
   PENTA PROJECT - CUSTOM DESIGN SYSTEM & RESPONSIVE STYLES
   Subdomain: mako.pentatech.my.id
   ========================================================= */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --bg-header: #1e293b;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-accent: #38bdf8;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #f8fafc;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Fonts */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Utility Helpers */
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 10px; align-items: center; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-right { text-align: right; }
.ml-2 { margin-left: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-4 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }

.btn-success { background: var(--color-success); color: white; }
.btn-warning { background: var(--color-warning); color: white; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-light { background: #f1f5f9; color: var(--text-main); border-color: #cbd5e1; }
.btn-outline-primary { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline-primary:hover { background: var(--color-primary); color: white; }
.btn-outline-danger { background: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn-outline-danger:hover { background: var(--color-danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }

/* Form Controls */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #475569; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #ffffff;
    transition: var(--transition);
    color: var(--text-main);
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-row { display: flex; gap: 12px; }
.form-row .col { flex: 1; }

/* ---------------------------------------------------------
   1. LOGIN PAGE STYLES
   --------------------------------------------------------- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    animation: fadeIn 0.4s ease-out;
}
.login-header { text-align: center; margin-bottom: 28px; }
.brand-badge-logo {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 10px 20px rgba(2, 132, 199, 0.25));
}
.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sidebar-logo-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}
.brand-title { font-family: 'Outfit', sans-serif; font-size: 26px; font-weight: 700; color: #0f172a; }
.brand-subdomain { font-size: 13px; color: var(--color-primary); font-weight: 600; margin-top: 2px; }

.login-demo-info {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed #e2e8f0;
    text-align: center;
}
.demo-title { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--color-primary);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}
.chip:hover { background: var(--color-primary); color: white; }

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---------------------------------------------------------
   2. MAIN APPLICATION LAYOUT
   --------------------------------------------------------- */
.app-viewport {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header Bar */
.app-header {
    height: 64px;
    background: var(--bg-header);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.active-tab-title { font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 600; color: white; }

.header-right { display: flex; align-items: center; gap: 16px; }

/* Project & Account Dropdowns */
.dropdown { position: relative; }
.dropdown-toggle { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); }
.dropdown-toggle:hover { background: rgba(255,255,255,0.18); }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #ffffff;
    color: var(--text-main);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    padding: 8px 0;
    z-index: 200;
    animation: slideDown 0.2s ease-out;
}
.dropdown-header { padding: 8px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-divider { height: 1px; background: #e2e8f0; margin: 6px 0; }
.dropdown-items-scroll { max-height: 200px; overflow-y: auto; }

.avatar-btn { background: none; border: none; cursor: pointer; }
.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    border: 2px solid rgba(255,255,255,0.3);
}
.dropdown-user-info { padding: 12px 16px; }
.user-name { font-weight: 700; font-size: 14px; color: #0f172a; }
.user-role-badge { display: inline-block; padding: 2px 8px; font-size: 10px; font-weight: 700; background: #eff6ff; color: var(--color-primary); border-radius: 4px; margin-top: 4px; text-transform: uppercase; }

/* Sidebar Navigation (Desktop) */
.app-sidebar {
    width: 250px;
    background: #0f172a;
    color: white;
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 90;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-logo-small { width: 36px; height: 36px; background: var(--color-primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; }
.brand-text .title { display: block; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 15px; }
.brand-text .sub { display: block; font-size: 10px; color: var(--color-accent); }

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; background: var(--color-primary); font-weight: 600; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 11px; color: #64748b; text-align: center; }

/* Main Content Area */
.app-main-content {
    margin-left: 250px;
    padding: 24px;
    flex: 1;
    max-width: 1400px;
}
.tab-page { display: none; animation: fadeIn 0.3s ease-out; }
.tab-page.active { display: block; }

/* Mobile Bottom Navigation Bar (Requested UI requirement) */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 68px;
    padding-top: 8px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.08);
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 0;
}
.mobile-nav-item i {
    font-size: 22px;
    transition: transform 0.2s ease, color 0.2s ease;
}
.mobile-nav-item.active {
    color: var(--color-primary);
    font-weight: 700;
}
.mobile-nav-item.active i {
    transform: translateY(-2px) scale(1.08);
}
.mobile-nav-item:active i {
    transform: scale(0.95);
}

/* Responsive Visibility Helpers */
.desktop-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 991px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .app-main-content {
        margin-left: 0 !important;
        padding: 16px;
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 12px));
    }
    .app-header { padding: 0 14px; }
}

/* ---------------------------------------------------------
   3. METRICS & CARDS & TABLES
   --------------------------------------------------------- */
.section-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.project-title { font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 700; color: #0f172a; }
.project-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.metric-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.metric-body .label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 4px; }
.metric-body h3 { font-size: 20px; font-weight: 700; color: #0f172a; }

.card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--border-color); }
.card-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.chart-container { position: relative; height: 380px; min-height: 380px; width: 100%; }

/* Scope Cards Grid & Scope Items */
.scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.scope-card-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.scope-card-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
    border-left-color: var(--color-primary-hover);
}

.scope-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.scope-card-content {
    flex: 1;
    min-width: 0;
}

.scope-card-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.scope-card-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    word-break: break-word;
}

.badge-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    background: #eff6ff;
    color: var(--color-primary);
    border-radius: 20px;
    border: 1px solid #dbeafe;
}

.empty-scope-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
}

.empty-scope-state i {
    font-size: 40px;
    margin-bottom: 12px;
    color: #cbd5e1;
    display: block;
}

.empty-scope-state p {
    font-size: 14px;
    margin: 0;
}

/* Team Cards Grid & WhatsApp Button */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.team-member-card {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.team-info { display: flex; align-items: center; gap: 12px; }
.team-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.team-name { font-weight: 700; font-size: 13.5px; color: #0f172a; }
.team-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }

.btn-wa {
    background: #25d366;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(37,211,102,0.3);
    transition: var(--transition);
}
.btn-wa:hover { transform: scale(1.08); }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; }
.table th { background: #f8fafc; color: #475569; font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-main); vertical-align: middle; }
.table-hover tbody tr:hover { background: #f1f5f9; }

/* Filter Engine Row */
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; }
.filter-group { flex: 1; min-width: 160px; }

/* Daily Report Photo Grid Feed */
.reports-feed { display: flex; flex-direction: column; gap: 20px; }
.report-card { background: white; border-radius: var(--radius-md); border: 1px solid var(--border-color); padding: 20px; box-shadow: var(--shadow-sm); }
.report-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.report-date { font-size: 12px; font-weight: 700; color: var(--color-primary); background: #eff6ff; padding: 4px 10px; border-radius: 20px; }
.report-category { font-size: 15px; font-weight: 700; color: #0f172a; margin-top: 4px; }
.report-desc { font-size: 14px; color: #334155; line-height: 1.6; margin-bottom: 16px; white-space: pre-line; }

/* 2 Photo per Row Grid (Requirement match) */
.report-photos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.report-photo-item {
    aspect-ratio: 4/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #e2e8f0;
    cursor: pointer;
}
.report-photo-item img { width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.report-photo-item img:hover { transform: scale(1.04); }

.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
}
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }

/* Lightbox Modal */
.lightbox-content { max-width: 90vw; max-height: 85vh; border-radius: 12px; overflow: hidden; }
.lightbox-content img { width: 100%; height: auto; max-height: 85vh; object-fit: contain; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}
.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}
.modal-lg { max-width: 680px; }
.modal-header { padding: 18px 24px; background: #f8fafc; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 17px; font-weight: 700; color: #0f172a; }
.btn-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 24px; max-height: 75vh; overflow-y: auto; }
.modal-footer { padding: 16px 24px; background: #f8fafc; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    background: #0f172a;
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    animation: fadeIn 0.3s ease-out;
}

/* Keyframe Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* Table Material Specific Column Wrapping Rules */
#table-materials th:nth-child(1),
#table-materials td:nth-child(1) {
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 150px;
}

#table-materials th:nth-child(4),
#table-materials td:nth-child(4),
#table-materials th:nth-child(5),
#table-materials td:nth-child(5) {
    white-space: nowrap !important;
}
