/* Smart Geo-Attendance System - Admin Panel Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    font-size: 16px; /* Base font size for mobile */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Mobile-first responsive container */
@media (min-width: 576px) {
    .container {
        padding: 0 20px;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 0 25px;
    }
}

@media (min-width: 992px) {
    .container {
        padding: 0 30px;
    }
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.system-title {
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.user-menu a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Navigation */
.nav {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav ul {
    list-style: none;
    display: flex;
}

.nav li {
    position: relative;
}

.nav a {
    display: block;
    padding: 1rem 1.5rem;
    color: #555;
    text-decoration: none;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav a:hover, .nav a.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.card h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.card .stat {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.card .stat.present { color: #28a745; }
.card .stat.absent { color: #dc3545; }
.card .stat.late { color: #ffc107; }
.card .stat.leave { color: #17a2b8; }

/* Tables */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-present { background: #d4edda; color: #155724; }
.status-absent { background: #f8d7da; color: #721c24; }
.status-late { background: #fff3cd; color: #856404; }
.status-leave { background: #d1ecf1; color: #0c5460; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.close {
    float: right;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle:focus {
    outline: none;
}

/* Mobile-first responsive design */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 0 10px;
    }

    /* Header */
    .header {
        padding: 0.75rem 0;
    }

    .header .container {
        flex-direction: row;
        justify-content: space-between;
    }

    .logo {
        font-size: 1.2rem;
        gap: 0.3rem;
    }

    .system-title {
        font-size: 1rem;
    }

    .user-menu {
        gap: 0.5rem;
    }

    .user-menu a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Navigation */
    .nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: #fff;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        overflow-y: auto;
    }

    .nav.active {
        left: 0;
    }

    .nav ul {
        flex-direction: column;
        padding: 4rem 0 2rem 0;
    }

    .nav a {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #f0f0f0;
        font-size: 1rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Main Content */
    .main-content {
        padding: 1rem 0;
    }

    /* Dashboard Cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .card .stat {
        font-size: 1.5rem;
    }

    /* Tables */
    .table-container {
        border-radius: 8px;
        margin-bottom: 1.5rem;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Touch-friendly */
    }

    /* Modals */
    .modal-content {
        margin: 5% auto;
        padding: 1.5rem;
        width: 95%;
        max-width: none;
    }

    /* Page Headers */
    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Stats Cards */
    .stats-cards {
        gap: 1rem !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .stat-number {
        font-size: 1.75rem !important;
    }

    /* Filters */
    .filters {
        padding: 1rem;
    }

    .filter-row {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Map */
    #map {
        height: 250px;
    }

    /* Footer */
    .footer {
        padding: 1.5rem 0;
        font-size: 0.85rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav ul {
        justify-content: center;
    }

    .nav a {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        min-height: 44px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.875rem;
        min-height: 44px;
    }

    .modal-content {
        width: 90%;
    }

    #map {
        height: 350px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .nav a {
        padding: 1rem 1.25rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn {
        min-height: 40px;
    }
}

/* Touch-friendly improvements for all devices */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    .nav a:hover {
        background-color: rgba(102, 126, 234, 0.1);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        color: #fff;
    }

    .card {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-icon {
    margin-left: 0.5rem;
    transition: transform 0.3s;
}

.dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    border: 1px solid #e0e0e0;
}

.dropdown-menu li {
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu a {
    padding: 0.75rem 1rem;
    white-space: nowrap;
    border-bottom: none;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
    color: #667eea;
}

.dropdown.active .dropdown-menu {
    display: block;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map Container */
#map {
    height: 400px;
    width: 100%;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}
