/* FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@700&family=Montserrat:wght@400;500;600&display=swap');

/* BASIC RESET & THEME */
:root {
    --primary-green: #2e7d32; /* Brighter Green */
    --dark-green: #004d40;   /* Deep Jungle Green */
    --background-dark: #004d40; /* JUNGLE GREEN THEME */
    --text-light: #e0f2f1;
    --text-muted: #b2dfdb;
    --border-color: rgba(255, 255, 255, 0.15);
    --module-bg: rgba(0, 0, 0, 0.2);
    --live-red: #ff0000;
    --delete-red: #c62828;
    --delete-red-hover: #e53935;
    --form-bg: #00382e;
    --input-bg: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    margin: 0;
    padding-top: 80px; /* Space for fixed header */
}

/* GLOBAL UI SHELL */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 51, 41, 0.8); /* Darker green for header */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    padding: 10px 20px;
    box-sizing: border-box;
}
.header-content {
    max-width: 95%; 
    margin: 0 auto; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.logo-link img { height: 60px; vertical-align: middle; }

/* --- THIS IS THE FIX: Reduced gap to bring buttons closer together --- */
.main-nav { display: flex; align-items: center; gap: 2px; }

/* --- THIS IS THE FIX: Reduced padding and font-size to make buttons smaller --- */
.main-nav a.nav-button, .main-nav .dropbtn {
    color: var(--text-light); 
    text-decoration: none; 
    padding: 8px 10px; /* Reduced horizontal padding */
    border-radius: 5px; 
    transition: background-color 0.3s; 
    font-size: 0.85rem; /* Slightly smaller font */
    white-space: nowrap;
}
.main-nav a.nav-button:hover, .main-nav .dropdown:hover .dropbtn, .main-nav a.nav-button.active {
    background-color: var(--primary-green);
}

.dropbtn { background-color: inherit; border: none; font-family: inherit; cursor: pointer; }
.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; background-color: #2e7d32; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 5px; }
.dropdown-content a { color: var(--text-light); padding: 12px 16px; text-decoration: none; display: block; font-size: 0.9rem; }
.dropdown-content a:hover {background-color: #3d8f41;}
.dropdown:hover .dropdown-content { display: block; }

/* MAIN LAYOUT */
.page-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 20px;
}

/* PAGE HEADER */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
}
.page-header h1 {
    font-family: 'Merriweather', serif;
    font-size: 3rem;
    margin: 0;
}
.page-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* FEATURED CAM SECTION */
.featured-cam-section {
    margin-bottom: 3rem;
}
.featured-cam-section h2 {
    font-family: 'Merriweather', serif;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}
.featured-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden; /* To keep iframe contained */
}
.featured-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* LIVE CAM GRID */
.live-cam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.cam-card {
    background-color: var(--module-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-light);
    position: relative;
}
.cam-card-clickable-area {
    cursor: pointer;
}
.cam-preview {
    width: 100%;
    height: 180px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    position: relative;
}
.cam-preview iframe {
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none; /* Make the card clickable, not the iframe */
}
.live-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--live-red);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}
.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.cam-info {
    padding: 1rem;
}
.cam-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}
.cam-info .location, .cam-info .viewers {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.cam-info .viewers {
    margin-top: 0.5rem;
}

/* STYLES FOR ADMIN CONTROLS */
.admin-controls {
    text-align: center;
    margin-bottom: 2rem;
}
.btn-add-cam {
    background-color: var(--primary-green);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}
.btn-add-cam:hover {
    background-color: #388e3c;
}
.admin-card-controls {
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.btn-delete-cam {
    background-color: var(--delete-red);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.btn-delete-cam:hover {
    background-color: var(--delete-red-hover);
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: var(--form-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
    font-family: 'Merriweather', serif;
    margin: 0;
    font-size: 1.5rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}
#cam-form {
    padding: 1.5rem;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 10px;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
}
.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-group-checkbox input {
    width: auto;
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}
.btn-save {
    background-color: var(--primary-green);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}
.btn-save:hover {
    background-color: #388e3c;
}
.form-error-summary {
    background-color: rgba(255, 77, 77, 0.15);
    color: var(--error-red);
    border: 1px solid var(--error-red);
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    display: none; /* Hidden by default */
}