/* web-admin/style.css */
/* Clean, high-density corporate dashboard styling sheet */

:root {
    --primary-color: #0F172A; /* Slate 900 */
    --secondary-color: #0284C7; /* Sky 600 */
    --success-color: #16A34A; /* Green 600 */
    --warning-color: #D97706; /* Amber 600 */
    --danger-color: #DC2626; /* Red 600 */
    --background-color: #F1F5F9; /* Slate 100 */
    --sidebar-background: #0F172A;
    --card-background: #FFFFFF;
    --text-color: #1E293B; /* Slate 800 */
    --text-muted: #64748B; /* Slate 500 */
    --border-color: #E2E8F0; /* Slate 200 */
    --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Container Layout */
.client-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Structure */
.admin-sidebar {
    width: 260px;
    background-color: var(--sidebar-background);
    color: #F8FAFC;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #1E293B;
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid #1E293B;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    height: 48px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.15s;
    cursor: pointer;
}

.menu-item a:hover {
    color: #FFFFFF;
    background-color: #1E293B;
}

.menu-item.active a {
    color: #FFFFFF;
    background-color: var(--secondary-color);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid #1E293B;
    font-size: 0.8rem;
    color: #64748B;
}

/* Main Dashboard Panel */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top bar navigation */
.top-navbar {
    height: 70px;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.nav-search {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.profile-details {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scrollable Inner Panel Container */
.dashboard-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Page titles */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Grid Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1.5rem;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.metric-meta {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.metric-meta.success { color: var(--success-color); }
.metric-meta.danger { color: var(--danger-color); }

/* High Density Tables */
.table-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-header-bar {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: #F8FAFC;
}

/* Status Pill Indicators */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pill.pill-success {
    background-color: #DCFCE7;
    color: #15803D;
}

.pill.pill-warning {
    background-color: #FEF9C3;
    color: #A16207;
}

.pill.pill-danger {
    background-color: #FEE2E2;
    color: #B91C1C;
}

.trust-index-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 120px;
}

.trust-bar-bg {
    flex: 1;
    height: 6px;
    background-color: #F1F5F9;
    border-radius: 3px;
    overflow: hidden;
}

.trust-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.trust-value {
    font-weight: 700;
    font-family: monospace;
    font-size: 0.85rem;
}

/* Side Drawer (Details Panel) */
.details-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    height: 100vh;
    background-color: #FFFFFF;
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 25px -5px rgb(0 0 0 / 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
}

.details-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.drawer-close-btn {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.drawer-section {
    margin-bottom: 2rem;
}

.drawer-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Audit log entries list */
.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-event {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    position: relative;
}

.timeline-event.danger { border-left-color: var(--danger-color); }
.timeline-event.warning { border-left-color: var(--warning-color); }

.event-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.event-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0.15rem 0;
}

.event-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Branding Form Configuration */
.branding-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-picker-input {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

/* Button general overrides */
.admin-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s;
}

.admin-btn:hover {
    background-color: #F8FAFC;
    border-color: #94A3B8;
}

.admin-btn-primary {
    background-color: var(--secondary-color);
    color: #FFFFFF;
    border-color: var(--secondary-color);
}

.admin-btn-primary:hover {
    opacity: 0.9;
}

/* Grid layout for Dashboard page */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--background-color);
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    z-index: 2000;
}

.login-brand-side {
    background-color: var(--primary-color);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5rem;
    position: relative;
    overflow: hidden;
}

.login-brand-side::before {
    content: "";
    position: absolute;
    top: -20%;
    right: -20%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(2, 132, 199, 0.12) 0%, rgba(2, 132, 199, 0) 70%);
}

.login-form-side {
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem;
}

.login-card {
    max-width: 400px;
    width: 100%;
    background: none;
    box-shadow: none;
    padding: 0;
}

@media (max-width: 868px) {
    .login-modal {
        grid-template-columns: 1fr;
    }
    .login-brand-side {
        display: none;
    }
    .login-form-side {
        padding: 2.5rem;
    }
}

/* Forms & Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    background-color: #FFFFFF;
    outline: none;
    transition: all 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Custom buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    width: 100%;
    text-align: center;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: #FFFFFF;
    border-color: var(--secondary-color);
}

.btn-primary:hover {
    opacity: 0.95;
    box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.2);
}

.hidden {
    display: none !important;
}

/* Responsive Enhancements */

/* Table Wrapper for Horizontal Scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Flexbox Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.col-8 {
    flex: 2;
    min-width: 320px;
}
.col-4 {
    flex: 1;
    min-width: 280px;
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    transition: background-color 0.15s;
    margin-right: 1rem;
}

.menu-toggle:hover {
    background-color: var(--background-color);
}

/* Media Queries */

/* Tablet & Mobile Layouts */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Reset columns to stack and take full width without min-width overflow */
    .col-8, .col-4 {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    body {
        overflow: auto; /* Allow scrolling if container is not 100vh */
    }
    
    .client-container {
        position: relative;
    }
    
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 270px;
        z-index: 1500;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 25px rgba(15, 23, 42, 0.25);
    }
    
    .top-navbar {
        padding: 0 1.25rem;
        justify-content: flex-start;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .nav-search {
        flex: 1;
        font-size: 1rem;
    }
    
    .dashboard-content {
        padding: 1.25rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .page-header .admin-btn {
        width: 100%;
        text-align: center;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .metric-card {
        padding: 1.25rem;
    }
}

/* Small Viewports (Smartphones) */
@media (max-width: 576px) {
    .branding-grid {
        grid-template-columns: 1fr;
    }
    
    .details-drawer {
        width: 100%;
    }
    
    .user-profile {
        margin-left: auto;
    }
    
    .profile-details {
        display: none; /* Hide name/role on very small screens to save space */
    }
    
    .table-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
    }
    
    .table-header-bar .form-control {
        width: 100% !important;
    }
}

/* Mobile Logo Branding Header */
.login-mobile-header {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    text-align: center;
}

.login-mobile-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.login-mobile-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-color);
}

@media (max-width: 868px) {
    .login-mobile-header {
        display: flex;
    }
}
