/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: #f0f2f5;
    min-height: 100vh;
}

/* Remove the centering from body for dashboard pages */
body:not(.login-page) {
    display: block;
}

/* Keep centering only for login page */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login Page Styles */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
    text-align: center;
    color: #1a73e8;
    margin-bottom: 30px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #1a73e8;
}

button {
    width: 100%;
    padding: 12px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #1557b0;
}

/* Dashboard Styles */
.dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 250px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    padding: 1rem;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
}

.sidebar.active {
    transform: translateX(0);
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
}

.main-content {
    margin-left: 250px;
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Mobile Menu Toggle - Global Styles */
.mobile-menu-toggle {
    display: none;
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 10000 !important;
    background: #2c3e50 !important;
    color: white !important;
    border: none !important;
    padding: 12px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
    transition: background-color 0.3s ease, transform 0.1s ease !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-width: 50px !important;
    min-height: 44px !important;
    flex-direction: row !important;
}

.mobile-menu-toggle:hover {
    background: #34495e !important;
}

.mobile-menu-toggle:active {
    transform: scale(0.95) !important;
}

.mobile-menu-toggle i {
    font-size: 20px !important;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.sidebar-overlay.active {
    display: block;
}

/* Admin Dashboard Specific Styles */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stats-container .card {
    text-align: center;
    padding: 20px;
}

.stats-container .stat {
    font-size: 36px;
    font-weight: bold;
    color: #1a73e8;
    margin: 10px 0;
}

.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #1557b0;
}

/* Table Styles */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.actions-column {
    min-width: 200px;
}

.actions-cell {
    padding: 8px 15px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.photo-cell {
    width: 80px;
}

.visitor-photo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* Card styles */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pending-approvals {
    cursor: pointer;
    transition: transform 0.2s;
}

.pending-approvals:hover {
    transform: translateY(-2px);
}

/* Button styles */
.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.success {
    background-color: #28a745;
    color: white;
}

.danger {
    background-color: #dc3545;
    color: white;
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-direction: row !important;
        top: 10px !important;
        left: 10px !important;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-top: 4rem !important;
        width: 100% !important;
    }

    .dashboard {
        padding-top: 0;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        margin: 10px -15px;
        border-radius: 0;
    }
    
    .action-buttons {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .btn-small {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .sidebar {
        width: 280px !important;
        max-width: 85vw !important;
        transform: translateX(-100%) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    /* Sidebar should be visible but hidden off-screen, not display:none */
    /* This allows content to be visible when toggled */
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        transition: transform 0.3s ease-in-out !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        top: 0 !important;
        height: 100vh !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
    }
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.pending {
    background: #ffd700;
    color: #000;
}

.status-badge.approved {
    background: #28a745;
    color: white;
}

.status-badge.rejected {
    background: #dc3545;
    color: white;
}

.status-badge.checked_out {
    background: #6c757d;
    color: white;
}

/* Action Buttons */
.btn-action {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    margin: 0 0.25rem;
    display: inline-flex;
    align-items: center;
}

.btn-action i {
    margin-right: 0.375rem;
}

.btn-action.approve {
    background: #28a745;
    color: white;
}

.btn-action.reject {
    background: #dc3545;
    color: white;
}

.btn-action.checkout {
    background: #17a2b8;
    color: white;
}

/* Filters */
.filters {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    min-width: 150px;
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    background: white;
}

.pagination a:hover {
    background: #f5f5f5;
}

.pagination a.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.pagination .ellipsis {
    padding: 8px;
    color: #666;
}

.pagination .prev,
.pagination .next {
    font-weight: 500;
}

/* Mobile responsiveness for tables */
@media screen and (max-width: 768px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters select {
        width: 100%;
    }
    
    .pagination {
        padding: 0 10px;
    }
    
    .pagination a {
        padding: 6px 10px;
    }
    
    .table-container {
        margin: 10px -15px;
        border-radius: 0;
        box-shadow: none;
    }
    
    .status-badge {
        white-space: nowrap;
    }
}

/* Text Alignment */
.text-center {
    text-align: center;
}

/* Links */
a {
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #1557b0;
    text-decoration: underline;
}

/* Form Validation */
input:invalid {
    border-color: #f44336;
}

input:valid {
    border-color: #4caf50;
}

/* Password Strength Indicator */
.password-strength {
    height: 4px;
    margin-top: 5px;
    border-radius: 2px;
    transition: all 0.3s;
}

.password-strength.weak {
    background: #f44336;
    width: 33%;
}

.password-strength.medium {
    background: #ffa726;
    width: 66%;
}

.password-strength.strong {
    background: #4caf50;
    width: 100%;
}

/* Pending Approvals Card */
.pending-approvals {
    background: linear-gradient(135deg, #ff9800, #f44336);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.pending-approvals:hover {
    transform: translateY(-5px);
}

.pending-approvals .stat {
    color: white;
}

.rejected-users {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.rejected-users:hover {
    transform: translateY(-5px);
}

.rejected-users .stat {
    color: white;
}

.total-users {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.total-users:hover {
    transform: translateY(-5px);
}

.total-users .stat {
    color: white;
}

.security-staff {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.security-staff:hover {
    transform: translateY(-5px);
}

.security-staff .stat {
    color: white;
}

.total-units {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.total-units:hover {
    transform: translateY(-5px);
}

.total-units .stat {
    color: white;
}

.todays-visitors {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
}

.todays-visitors:hover {
    transform: translateY(-5px);
}

.todays-visitors .stat {
    color: white;
}

/* Action Buttons */
.actions {
    white-space: nowrap;
}

.btn-small.success {
    background: #4caf50;
    color: white;
}

.btn-small.success:hover {
    background: #388e3c;
}

.btn-small.error {
    background: #f44336;
    color: white;
}

.btn-small.error:hover {
    background: #d32f2f;
}

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

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f6f8;
    color: #333;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    padding: 20px;
}

.sidebar h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    margin-bottom: 10px;
}

.sidebar nav ul li a {
    color: white;
    text-decoration: none;
    padding: 10px;
    display: block;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
    background-color: #34495e;
}

.main-content {
    flex: 1;
    padding: 20px;
}

.header {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 0;
}

.header .btn {
    align-self: flex-start;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-card small {
    display: block;
    color: #6c757d;
    font-size: 12px;
    margin-top: 10px;
}

.stat-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #3498db;
}

/* Cards */
.card {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Status Badges */
.status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.pending {
    background-color: #ffeeba;
    color: #856404;
}

.status-badge.approved {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.rejected {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.completed {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn.primary {
    background-color: #3498db;
    color: white;
}

.btn.primary:hover {
    background-color: #2980b9;
}

.btn.danger {
    background-color: #e74c3c;
    color: white;
}

.btn.danger:hover {
    background-color: #c0392b;
}

.btn.small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Header with Actions */
.header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.date-filter input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Camera Section Styles */
.camera-section {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.camera-container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.camera-box {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

#camera, #photoCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.camera-controls {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0 1rem;
    z-index: 10;
}

.camera-error {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    max-width: 80%;
}

.camera-error.active {
    display: block;
}

.btn-action {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    display: inline-block;
}

.btn-action:hover {
    background: rgba(0, 0, 0, 0.8);
}

.btn-action.active {
    display: inline-block;
}

/* Notification System */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 4px;
    color: white;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background: #4caf50;
}

.notification.error {
    background: #f44336;
}

.notification.info {
    background: #2196f3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Media Queries for Responsive Design */
@media screen and (max-width: 1024px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transition: transform 0.3s ease-in-out !important;
        width: 280px !important;
        max-width: 85vw !important;
        transform: translateX(-100%) !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        z-index: 10000 !important;
        background: #2c3e50 !important;
        color: white !important;
        padding: 12px 16px !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        border: none !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-direction: row !important;
        gap: 8px !important;
        min-width: 50px !important;
        min-height: 44px !important;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        padding: 10px;
    }
    
    .card {
        margin: 10px 0;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .header {
        padding-top: 60px;
    }
}

@media screen and (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-small {
        width: 100%;
        margin: 2px 0;
    }
    
    .stats-container .stat {
        font-size: 28px;
    }
    
    .card {
        padding: 15px;
    }
    
    input, select, button {
        font-size: 14px;
        padding: 10px;
    }
}

@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-direction: row !important;
        top: 10px !important;
        left: 10px !important;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-top: 4rem !important;
        width: 100% !important;
    }
}

@media screen and (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .sidebar {
        transform: none;
        transition: none;
    }

    .main-content {
        margin-left: 250px;
        padding: 2rem;
    }
}
