/* E-WASPADA Styles */

:root {
    --primary-color: #035229;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --dark-color: #1a252f;
    --light-color: #ecf0f1;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #dfe6e9;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #026a2f 0%, #034e27 100%);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1000px;
    width: 100%;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-left {
    background: linear-gradient(135deg, #0a3a21 0%, #0a351e 100%);
    color: var(--white);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.login-image {
    font-size: 120px;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

.login-image img {
    max-width: 250px;
    max-height: 250px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.login-left h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.login-left .subtitle {
    font-size: 16px;
    opacity: 0.95;
    line-height: 1.5;
}

.login-right {
    padding: 60px 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
}

.login-header {
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}

.form-group label i {
    margin-right: 5px;
    color: var(--secondary-color);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px 10px;
    font-size: 16px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--secondary-color);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sso {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sso:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.btn-sso:active {
    transform: translateY(0);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.login-footer i {
    color: var(--success-color);
    margin-right: 5px;
}

/* Alert Messages */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    margin-right: 10px;
    font-size: 16px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
    }

    .login-left {
        padding: 40px 30px;
    }

    .login-left h1 {
        font-size: 32px;
    }

    .login-image {
        font-size: 80px;
    }

    .login-image img {
        max-width: 250px;
        max-height: 250px;
        width: auto;
    }

    .login-right {
        padding: 40px 30px;
    }

    .login-header h2 {
        font-size: 26px;
    }
}

/* Dashboard Styles */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: #f5f6fa;
}

.sidebar {
    width: 260px;
    background: var(--primary-color);
    color: var(--white);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu li a i {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--secondary-color);
}

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

.topbar {
    background: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h2 {
    color: var(--primary-color);
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
}

.logout-btn {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
}

/* Map Container */
#map {
    height: 600px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.map-container {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

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

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--white);
}

.stat-icon.primary { background: var(--primary-color); }
.stat-icon.success { background: var(--success-color); }
.stat-icon.warning { background: var(--warning-color); }
.stat-icon.danger { background: var(--danger-color); }

.stat-details h3 {
    font-size: 32px;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.stat-details p {
    color: var(--text-light);
    font-size: 14px;
}

/* Table */
.table-container {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.table-header h3 {
    color: var(--primary-color);
    font-size: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--light-color);
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--light-color);
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

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

.status-badge.departed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.overstay {
    background: #fff3cd;
    color: #856404;
}

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

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--white);
}

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

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #229954;
}

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

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #27ae60;
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #27ae60;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch input:disabled + .toggle-slider {
    background-color: #dfe6e9;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive Styles for Tablets and Mobile */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Dashboard Layout */
    .dashboard {
        flex-direction: column;
    }

    /* Sidebar */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

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

    /* Main Content */
    .main-content {
        margin-left: 0;
        padding: 70px 15px 15px;
        width: 100%;
    }

    /* Topbar */
    .topbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        margin-bottom: 15px;
    }

    .topbar h2 {
        font-size: 20px;
        text-align: center;
    }

    .user-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .user-profile {
        flex-direction: column;
        text-align: center;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 20px;
    }

    /* Map */
    #map {
        height: 400px;
    }

    .map-container {
        padding: 15px;
    }

    /* Table */
    .table-container {
        margin-top: 20px;
    }

    .table-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .table-header h3 {
        font-size: 16px;
        text-align: center;
        width: 100%;
    }

    .table-header .btn {
        width: 100%;
        justify-content: center;
    }

    .table-header select,
    .table-header input {
        width: 100%;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }

    /* Make table scrollable horizontally */
    .table-container > div[style*="overflow-x: auto"] {
        -webkit-overflow-scrolling: touch;
    }

    /* Buttons */
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Notification Panel */
    #notificationPanel {
        right: 10px !important;
        top: 70px !important;
        width: calc(100% - 20px) !important;
        max-width: 350px;
    }

    /* Modals */
    .modal-content {
        margin: 10px !important;
        width: calc(100% - 20px) !important;
        max-width: none !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .topbar h2 {
        font-size: 18px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .stat-details h3 {
        font-size: 24px;
    }

    .stat-details p {
        font-size: 12px;
    }

    #map {
        height: 300px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 5px;
    }

    .status-badge {
        font-size: 10px;
        padding: 4px 8px;
    }

    /* Sidebar */
    .sidebar-header h1 {
        font-size: 20px;
    }

    .sidebar-menu li a {
        font-size: 14px;
        padding: 10px 15px;
    }

    .sidebar-menu li a i {
        font-size: 16px;
    }

    /* User avatar smaller */
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    /* Logout button */
    .logout-btn {
        width: 100%;
        justify-content: center;
    }
}
