/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

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

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-menu a:hover {
    opacity: 0.8;
}

/* Icons hidden on desktop, labels always shown */
.nav-icon {
    display: none;
    flex-shrink: 0;
}

/* Main content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 2rem;
    color: #2c3e50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.quick-actions {
    margin-bottom: 3rem;
}

.quick-actions h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.recent-properties h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.property-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.property-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.property-card p {
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.property-card a:not(.btn) {
    color: #3498db;
    text-decoration: none;
}

.empty-state {
    background: white;
    padding: 3rem;
    text-align: center;
    border-radius: 8px;
    color: #7f8c8d;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-primary,
.btn-primary:link,
.btn-primary:visited {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    color: white;
}

.btn-secondary,
.btn-secondary:link,
.btn-secondary:visited {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    color: white;
}

/* Forms */
.form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Analysis page */
.analysis-form-container {
    margin-bottom: 3rem;
}

.analysis-form-container h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.results-container {
    margin-top: 3rem;
}

.results-container h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    height: 400px;
}

.rates-table {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rates-table h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

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

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f5f7fa;
    font-weight: 600;
    color: #2c3e50;
}

table tr:hover {
    background-color: #f5f7fa;
}

/* Property Detail Page */
.property-detail {
    max-width: 1400px;
    margin: 0 auto;
}

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

.page-header h1 {
    color: #2c3e50;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.property-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.info-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.info-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.info-card p {
    margin-bottom: 0.5rem;
    color: #555;
}

.rates-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rates-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.rates-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.rates-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.rates-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.rates-table-container {
    margin-top: 2rem;
    overflow-x: auto;
}

.rates-table {
    width: 100%;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.error {
    color: #e74c3c;
}

/* Login page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f5f7fa;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.login-title {
    text-align: center;
    color: #2c3e50;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.login-form {
    margin-top: 1rem;
}

.btn-block {
    width: 100%;
}

/* Nav user section */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.nav-user span {
    font-size: 0.9rem;
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background-color: #e74c3c;
    color: white;
}

.role-viewer {
    background-color: #3498db;
    color: white;
}

/* Sign out button */
.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: rgba(255,255,255,0.15);
}

/* Alert messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nav-username {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-username:hover {
    text-decoration: underline;
}

/* Danger button */
.btn-danger {
    background-color: #e74c3c;
    color: white;
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 1000px) {
    /* Fix navbar to viewport so horizontal drag doesn't shift it */
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 0;
    }

    /* Two-row grid: [brand | user] on top, [nav] below */
    .navbar .container {
        display: grid;
        grid-template-areas:
            "brand user"
            "nav   nav";
        grid-template-columns: 1fr auto;
        max-width: 100%;
        padding: 0;
    }

    .nav-brand {
        grid-area: brand;
        padding: 0.65rem 1rem;
        display: flex;
        align-items: center;
    }

    .nav-brand a {
        font-size: 1.1rem;
    }

    .nav-user {
        grid-area: user;
        padding: 0.65rem 1rem;
        gap: 0.5rem;
    }

    /* Hide role badge and sign-out on mobile — user accesses via /account */
    .role-badge,
    .btn-logout {
        display: none;
    }

    .nav-menu {
        grid-area: nav;
        gap: 0;
        justify-content: space-around;
        padding: 0.4rem 0;
        border-top: 1px solid rgba(255,255,255,0.12);
    }

    .nav-menu li {
        flex: 1;
        text-align: center;
    }

    .nav-menu a {
        flex-direction: column;
        justify-content: center;
        gap: 0;
        padding: 0.2rem 0;
    }

    /* Icons visible, labels hidden on mobile */
    .nav-icon {
        display: block;
    }

    .nav-label {
        display: none;
    }

    /* Push content below fixed navbar (~88px tall) */
    .main-content {
        padding-top: 6rem;
    }

    .form-row {
        flex-direction: column;
    }

    .stats-grid,
    .results-summary {
        grid-template-columns: 1fr;
    }
}
