/* ASDPS Appraisal System - Modern Responsive Styles */

:root {
    --primary-color: #2c5282;
    --primary-dark: #1a365d;
    --secondary-color: #4a5568;
    --accent-color: #38a169;
    --danger-color: #e53e3e;
    --warning-color: #d69e2e;
    --light-bg: #f7fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #2d3748;
    --text-muted: #718096;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.10);
    --radius: 4px;
    --radius-lg: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: var(--primary-color);
    color: var(--white);
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-brand a {
    color: var(--white);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1rem 0;
    display: block;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    margin: 5px 0;
    transition: 0.3s;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 1rem;
    display: block;
    transition: background 0.2s;
}

.nav-menu a:hover {
    background: var(--primary-dark);
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    list-style: none;
    overflow: hidden;
}

.dropdown-menu a {
    color: var(--text-color);
    padding: 0.75rem 1rem;
}

.dropdown-menu a:hover {
    background: var(--light-bg);
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.3);
    margin-left: 0.5rem;
}

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

.btn-logout {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 0.5rem 1rem !important;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        padding: 0.75rem 1rem;
    }

    .nav-dropdown .dropdown-menu {
        position: static;
        box-shadow: none;
        background: var(--primary-dark);
    }

    .nav-dropdown .dropdown-menu a {
        color: var(--white);
        padding-left: 2rem;
    }

    .nav-user {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.3);
        margin-left: 0;
        padding: 1rem 0 0 0;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-success:hover {
    background: #2f855a;
}

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

.btn-danger:hover {
    background: #c53030;
}

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

.btn-secondary:hover {
    background: #2d3748;
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.form-control-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23718096' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

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

.table th {
    background: var(--light-bg);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table tbody tr:hover {
    background: var(--light-bg);
}

.table-actions {
    white-space: nowrap;
}

/* Cost Table Grid - Based on COBOL form layout */
.cost-table-grid {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 2px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.cost-table-grid .header {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem;
    font-weight: 600;
    text-align: center;
    font-size: 0.875rem;
}

.cost-table-grid .row-num {
    background: var(--light-bg);
    padding: 0.25rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.cost-table-grid input {
    border: none;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    text-align: right;
    width: 100%;
    background: var(--white);
}

.cost-table-grid input:focus {
    outline: none;
    background: #ffffd0;
}

/* Cost Table Container */
.cost-table-container {
    max-height: 600px;
    overflow-y: auto;
}

.cost-table-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #feb2b2;
}

.alert-warning {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #faf089;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius);
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

.badge-primary {
    background: #bee3f8;
    color: #2a4365;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
