
:root {
    --primary-color: #4285f4;
    --secondary-color: #357ae8;
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #dddddd;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --font-stack: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-stack);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--card-background);
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: var(--primary-color);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Tool Grid (Landing Page) */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.tool-card {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Specific Tool Layouts */
.tool-container {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 10px; /** Increased padding for better touch targets */
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--secondary-color);
}

.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: var(--radius);
    border-left: 5px solid var(--primary-color);
}

/* Result specific styling */
.result-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    word-break: break-all;
}

/* Sidebar Layout (for Map Tool) */
.sidebar-layout {
    display: flex;
    height: calc(100vh - 80px); /* Adjust based on header height */
    margin: -2rem; /* Negate main padding to full width */
}

.sidebar {
    width: 320px;
    padding: 20px;
    background: #f5f5f5;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 10;
}

.map-content {
    flex: 1;
    position: relative;
}

/* Footer & Ads */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    background-color: var(--card-background);
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
}

.ad-container {
    margin: 20px auto;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    min-height: 90px; /* Space reserved for standard leaderboard */
    background: #f0f0f0; /* Visual placeholder color */
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px dashed #ccc;
}

.ad-label {
    font-size: 0.8rem;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar-layout {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }

    .map-content {
        height: 500px;
    }

    nav ul {
        gap: 10px;
        font-size: 0.9rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
    }
}
