* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 30px;
    background: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--primary-color);
}

.header-logo {
    height: 50px;
    width: auto;
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
    font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Styles */
.form-section {
    background: var(--surface);
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Tools Grid - Tile Style */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 10px 0;
}

.tools-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.tools-grid label:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.tools-grid input[type="checkbox"] {
    display: none;
}

.tools-grid label.checked {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.tools-grid label.checked::before {
    content: '✓ ';
    margin-right: 5px;
    font-weight: bold;
}

/* Regular Checkboxes (for barriers, etc.) */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    padding: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    font-size: 1rem;
}

.btn-secondary:hover {
    background-color: #059669;
}

.success-message {
    background: var(--surface);
    padding: 40px;
    text-align: center;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.success-message h3 {
    color: var(--secondary-color);
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.2rem;
}

#heatmap {
    min-height: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0;
}

.heatmap-cell {
    flex: 1 1 150px;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    color: white;
    font-weight: 600;
    transition: transform 0.2s;
}

.heatmap-cell:hover {
    transform: scale(1.05);
}

.heatmap-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.heatmap-value {
    font-size: 1.5rem;
}

/* Table Styles */
.table-container {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--primary-color);
    color: white;
}

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

th {
    font-weight: 600;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px !important;
}

/* Rating Scale Styles - Star Rating */
.rating-scale {
    padding: 15px 0;
}

.star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}

.star-rating input[type="radio"] {
    display: none;
}

.star-rating label {
    font-size: 2.2rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.star-rating label::before {
    content: "☆";
}

/* Hover effect - fills stars from left to selected */
.star-rating label:hover::before,
.star-rating label:hover ~ label::before {
    content: "★";
    color: #fbbf24;
}

/* Checked state - fills stars from left to selected */
.star-rating input[type="radio"]:checked ~ label::before {
    content: "★";
    color: #f59e0b;
}

.star-rating label:hover {
    transform: scale(1.1);
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
    padding: 0 5px;
    max-width: 300px;
}

.tool-ratings {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.tool-ratings h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.tool-ratings h4::before {
    content: "⚙️";
}

.rating-row {
    margin-bottom: 20px;
}

.rating-row:last-child {
    margin-bottom: 0;
}

.rating-row > label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

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

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tools-grid label {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   AUTHENTICATION OVERLAY
   ============================================ */

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95) 0%, rgba(29, 78, 216, 0.95) 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 32px 16px;
}

.auth-overlay.hidden {
    display: none;
}

.auth-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    height: 60px;
    margin-bottom: 20px;
}

.auth-header h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-step .form-group {
    margin-bottom: 20px;
}

.auth-step label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-step input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-step input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.info-text {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.info-text strong {
    color: var(--primary-color);
}

.full-width {
    width: 100%;
    margin-bottom: 12px;
}

.error-message {
    background: #fee2e2;
    border: 1px solid var(--danger-color);
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.auth-loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 4px solid rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
