/* Modern & Premium Design Variables */
:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary-color: #64748b;
    /* Slate 500 */
    --background-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Setup Inter if available, else system font */
    background-color: var(--background-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Container Styles */
.container {
    background-color: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Subtle border for glass effect hint */
    margin: auto 0;
}

.admin-container {
    max-width: 1200px;
    margin: 2rem;
    padding: 2rem;
    position: relative;
}

/* Typography */
h1 {
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
    font-size: 1.875rem;
}

h2 {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.5rem;
}

p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

input,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: #fff;
    transition: var(--transition);
    color: var(--text-primary);
    font-family: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    /* Focus ring */
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

/* Button Styles */
button {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Status Messages */
.status-message {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 600;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: var(--radius);
    padding: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.success {
    color: #047857;
    /* Emerald 700 */
    background-color: #ecfdf5;
    /* Emerald 50 */
    border: 1px solid #d1fae5;
    opacity: 1 !important;
}

.error {
    color: #b91c1c;
    /* Red 700 */
    background-color: #fef2f2;
    /* Red 50 */
    border: 1px solid #fee2e2;
    opacity: 1 !important;
}

/* Admin Map & Table */
#map {
    height: 600px;
    width: 100%;
    border-radius: var(--radius);
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    z-index: 1;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

th,
td {
    text-align: left;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

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

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

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 640px) {

    .container,
    .admin-container {
        padding: 1.5rem;
        margin: 1rem;
    }

    #map {
        height: 400px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.2s;
}

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

#detailMap {
    height: 400px;
    width: 100%;
    margin-top: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.view-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
    margin-top: 0;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-actions h2 {
    margin: 0;
}

.table-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.table-thumb:hover {
    transform: scale(1.1);
}

.truncate-text {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Logout Button Styling - Ultra Compact */
.logout-btn {
    position: absolute;
    top: 1rem !important;
    right: 1rem !important;
    width: auto !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    margin-top: 0 !important;
    background-color: #dc3545 !important;
    color: white !important;
    border-radius: var(--radius) !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: var(--shadow-sm) !important;
    transition: var(--transition) !important;
    z-index: 100;
}

.logout-btn:hover {
    background-color: #c82333 !important;
    transform: scale(1.05) !important;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
}

.toast {
    background: white;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    min-width: 300px;
    animation: toastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-color);
}

.toast.success {
    border-left-color: #10b981;
    /* Emerald 500 */
    color: #065f46;
    /* Emerald 800 */
}

.toast.error {
    border-left-color: #ef4444;
    /* Red 500 */
    color: #991b1b;
    /* Red 800 */
}

@keyframes toastSlideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.fade-out {
    animation: toastFadeOut 0.3s forwards;
}

@keyframes toastFadeOut {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}