:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --background-color: #f4f7f9;
    --container-bg: #ffffff;
    --text-color: #333;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    --accent-color: #e67e22;
    --color-2g: #3498db;
    --color-3g: #2ecc71;
    --color-4g: #e74c3c;
    --color-inactive: #95a5a6;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding-top: 60px; /* Space for fixed nav */
}

/* --- Login Page Styles --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 0;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-box {
    background: var(--container-bg);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}
.login-icon {
    background: var(--primary-color);
    color: white;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -80px auto 20px;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}
.login-box h2 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}
.login-box p {
    color: #777;
    margin-bottom: 30px;
}
.flash-error {
    color: var(--color-4g);
    margin-top: 15px;
    font-weight: bold;
}

/* --- Main App Styles --- */
.main-nav {
    background: var(--secondary-color);
    color: white;
    padding: 0 40px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.nav-brand {
    font-size: 1.5em;
    font-weight: 700;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 5px 10px;
    border-radius: 5px;
}
.nav-links a:hover {
    background-color: rgba(255,255,255,0.1);
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--container-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 20px;
}

header h1 {
    color: var(--secondary-color);
    margin: 0;
}

header p {
    color: #777;
    font-size: 1.1em;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-link {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #999;
    position: relative;
    transition: color 0.3s;
}

.tab-link.active {
    color: var(--primary-color);
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--secondary-color);
}

input[type="text"], input[type="password"] {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus, input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
    outline: none;
}

button[type="submit"], .location-btn {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    transition: background-color 0.3s, transform 0.2s;
}

button[type="submit"]:hover, .location-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.location-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.accuracy-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: var(--border-radius);
}

.accuracy-selector label {
    font-weight: 500;
    cursor: pointer;
}

.location-btn {
    background-color: var(--accent-color);
    width: 100%;
}

.location-btn:hover {
    background-color: #d35400;
}

#results {
    margin-top: 30px;
}

#results h2 {
    color: var(--secondary-color);
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.map-filters {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: var(--border-radius);
}

.map-filters label {
    font-weight: 500;
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

#map {
    height: 400px;
    width: 100%;
    border-radius: var(--border-radius);
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#coordinates {
    margin-top: 20px;
    font-size: 1.1em;
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: var(--border-radius);
}

.error {
    color: #e74c3c;
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
}

/* --- Nearest Towers Styles --- */
#nearest-towers {
    margin-top: 40px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

#nearest-towers h3 {
    text-align: center;
    color: var(--secondary-color);
    font-size: 1.5em;
    margin-bottom: 20px;
}

.towers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.tower-category h4 {
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid;
    font-size: 1.2em;
}

.tower-category.cat-2g h4 { border-color: var(--color-2g); color: var(--color-2g); }
.tower-category.cat-3g h4 { border-color: var(--color-3g); color: var(--color-3g); }
.tower-category.cat-4g h4 { border-color: var(--color-4g); color: var(--color-4g); }

.tower-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tower-card {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-left: 5px solid #ccc;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.tower-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.card-2g { border-left-color: var(--color-2g); }
.card-3g { border-left-color: var(--color-3g); }
.card-4g { border-left-color: var(--color-4g); }

.tower-card p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.6;
}

.tower-card p strong {
    color: var(--secondary-color);
}

.tower-card .distance {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--accent-color);
    margin-top: 10px;
    text-align: right;
}

.tower-card .ocid-status {
    font-style: italic;
    color: #777;
    font-size: 0.85em;
    margin-top: 5px;
}

.hidden {
    display: none;
}

/* --- Admin Panel Styles --- */
.admin-container {
    display: flex;
    padding-top: 0;
}
.admin-nav {
    width: 250px;
    background: var(--secondary-color);
    color: white;
    min-height: calc(100vh - 60px);
    padding: 20px;
}
.admin-nav h2 {
    margin-top: 0;
    text-align: center;
}
.admin-nav ul {
    list-style: none;
    padding: 0;
}
.admin-nav ul li a {
    display: block;
    padding: 10px;
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}
.admin-nav ul li a:hover {
    background: #34495e;
}
.admin-main {
    flex-grow: 1;
    padding: 30px;
}
.admin-section {
    background: var(--container-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}
.admin-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.kpi-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}
.kpi-card h4 {
    margin: 0 0 10px 0;
    color: var(--secondary-color);
}
.kpi-card p {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
}
.user-form {
    max-width: 500px;
}
.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flash-message {
    margin-top: 15px;
    color: var(--color-3g);
    font-weight: bold;
}
.table-container {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    white-space: nowrap;
}
th {
    background: #f9f9f9;
}
.status-active { color: var(--color-3g); font-weight: bold; }
.status-inactive { color: var(--color-inactive); font-weight: bold; }
.actions-cell { display: flex; gap: 10px; }
.btn-action {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 0.9em;
}
.btn-activate { background-color: var(--color-3g); }
.btn-deactivate { background-color: var(--color-inactive); }
.btn-change-password { background-color: var(--accent-color); }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: var(--border-radius);
    position: relative;
}
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}
.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

