@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #1a237e;
    /* Header Blue */
    --accent-blue: #2962ff;
    /* Start/Primary Button */
    --accent-green: #00c853;
    /* Save/Success Button */
    --accent-red: #d50000;
    /* Delete/Exit */
    --bg-gray: #f5f6fa;
    --input-border: #dfe6e9;
    --text-color: #2d3436;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin-top: 0;
    color: #333;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* HEADER - Matches the Dark Blue header in image */
.admin-nav {
    background: var(--primary-color);
    padding: 15px 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-nav h1 {
    color: white;
    margin: 0;
    font-size: 1.3rem;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* HERO (for Index) */
.hero {
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    border-radius: 0 0 30px 30px;
    margin-bottom: 40px;
}

/* CARDS - White container with rounded corners and shadow */
.login-box,
.unit-card,
.base-card,
.admin-container>div,
div[style*="background: white"] {
    background: #ffffff !important;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #f0f0f0;
}

/* FORMS & INPUTS - Matches the clean look */
form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    display: block;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    color: #333;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    /* Smooth rounded corners */
    transition: all 0.2s ease-in-out;
}

/* Input Focus Effect - Blue glow */
input:focus,
select:focus,
textarea:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

input::placeholder {
    color: #aaa;
}

/* Custom Select Arrow */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 40px;
}

/* BUTTONS - Matches the vibrant colors */
button,
.btn {
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-family: 'Sarabun', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.1s, opacity 0.2s;
    text-align: center;
}

button:active,
.btn:active {
    transform: scale(0.98);
}

button:hover,
.btn:hover {
    opacity: 0.9;
}

/* Primary Blue Button (Start/Login/Add) */
/* Primary Blue Button (Start/Login/Add) */
button[type="submit"],
button[name="add_unit"],
button[name="add_base"],
.btn-primary,
.btn-login {
    background-color: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
    /* Default full width for efficiency, overridden by inline styles if needed */
}

/* Success Green Button (Save) */
button[name="save_unit"],
button[name="save_group"],
button[name="save_base"],
button[name="save_staff"],
.btn-success {
    background-color: var(--accent-green);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Edit Button (Orange) */
.btn-edit {
    background-color: #ff9800;
    color: white !important;
    padding: 6px 14px;
    font-size: 0.9rem;
    box-shadow: none;
    width: auto;
}

/* Delete Button (Red) */
.btn-delete,
.btn-logout {
    background-color: var(--accent-red);
    color: white !important;
    padding: 6px 14px;
    font-size: 0.9rem;
    box-shadow: none;
    width: auto;
}

/* Cancel / Reset Button (Gray) */
a[href*="manage_"],
.btn-secondary {
    background-color: #f1f1f1;
    color: #555 !important;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

/* TABLE STYLING */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 10px;
}

th {
    background-color: #f8f9fa;
    color: #444;
    font-weight: 600;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #e9ecef;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

/* Modern Homepage Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    background: white;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    padding: 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #eef2f7;
    white-space: nowrap;
}

td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fcfcfc;
}

/* Status Badges in Table */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: transform 0.2s;
}

.status-icon.checked {
    background: #e8f8f5;
    color: #2ecc71;
}

.status-icon.pending {
    color: #ecf0f1;
}

/* Hero Button Hover Override */
.btn-login-hero:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Base Grid System (3 Columns) */
.bases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.base-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

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

.base-img-wrapper {
    height: 200px;
    overflow: hidden;
    background: #f0f0f0;
}

.base-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.base-img:hover {
    transform: scale(1.05);
}

.base-content {
    padding: 15px;
    flex-grow: 1;
}

.base-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #2c3e50;
}

.base-desc {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
}

/* Modal (Lightbox) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1.1rem;
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .bases-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .bases-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }


    .hero {
        padding: 40px 20px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .admin-nav {
        flex-direction: column;
        padding: 15px;
    }

    .admin-nav h1 {
        margin-bottom: 15px;
    }

    .admin-nav div {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .admin-nav a {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    .units-container,
    .bases-grid {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* PUBLIC NAVIGATION REMOVED - Using Bootstrap 5 in index.php */