@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #eab308;
    --bg-dark: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #0f172a;
    --text-muted: #475569;
    --glass-border: rgba(37, 99, 235, 0.15);
    --error: #ef4444;
    --success: #16a34a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(234, 179, 8, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: flex-start; /* Better for long forms */
    justify-content: center;
    overflow-x: hidden;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 1200px; /* Full screen desktop */
    padding: 0;
    margin: 1rem auto;
}

@media (max-width: 480px) {
    .container { margin: 0; }
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
    .card { padding: 1.5rem; border-radius: 16px; }
}

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

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

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #facc15);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

.btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* Appraisal Form Specific Styles */
.form-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.appraisal-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}
.appraisal-table th, .appraisal-table td {
    border: 1px solid var(--glass-border);
    padding: 0.75rem;
    text-align: left;
}
.appraisal-table th {
    background: #f8fafc;
    color: #1e293b;
    font-weight: 700;
}
.rating-scale-box {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
}
.rating-scale-box label {
    flex: 0 0 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s ease;
}
.rating-scale-box label:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.rating-scale-box input:checked + span {
    background: var(--accent);
    color: var(--bg-dark);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(234, 179, 8, 0.3);
}
.rating-scale-box span {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.rating-scale-box.inactive {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}

.comp-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1rem;
    font-size: 0.8125rem;
}
.comp-table th, .comp-table td {
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
}
.comp-table th {
    background: #f1f5f9;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.comp-category-title {
    background: #eff6ff;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid rgba(37, 99, 235, 0.1);
}
.comp-item-text {
    padding-left: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-main);
}
.comp-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    margin-top: 0.125rem;
    background: transparent;
    transition: all 0.2s ease;
}
.comp-checkbox:checked {
    background: var(--accent);
}
.comp-checkbox:checked::after {
    content: "✓";
    color: var(--bg-dark);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 900;
}
.calc-field {
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.03);
}
.dynamic-row-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    border: 1px dashed var(--accent);
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

/* Responsive Grid Layouts */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
    .form-grid.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: #ffffff;
}

.table-responsive table {
    width: 100%;
    min-width: 800px; /* Forces scroll on narrow mobile for complex tables */
    margin-bottom: 0;
}

/* Print Optimization */
@media print {
    body { background: white; padding: 0; }
    .container { max-width: 100%; margin: 0; }
    .card { border: none; box-shadow: none; padding: 0; }
    .btn, .dynamic-row-btn, .header-btns, a[href="dashboard.php"] { display: none !important; }
    .form-section { page-break-inside: avoid; border-bottom: 1px solid #eee; }
    .appraisal-table, .comp-table { font-size: 10pt; }
    .input-control { border: none; border-bottom: 1px solid #ccc; border-radius: 0; padding: 2px 0; }
    select.input-control { appearance: none; -webkit-appearance: none; }
    .rating-scale-box label { border: 1px solid #ccc; -webkit-print-color-adjust: exact; }
    .rating-scale-box input:checked + span { background: #eee !important; color: black !important; font-weight: bold; }
    h1, h2, h3 { color: black !important; }
    .section-title { color: #333 !important; border-bottom: 1px solid #333; }
}
