/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --warning: #f59e0b;
    --success: #16a34a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 2rem;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
}

.nav-links { display: flex; gap: 1.5rem; flex: 1; }
.nav-links a { color: var(--gray-700); font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: var(--primary); }

.nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--gray-500); }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: var(--gray-100); text-decoration: none; }

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

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

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

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.btn-icon { flex-shrink: 0; }

/* Google button */
.btn-google { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); width: 100%; justify-content: center; padding: 0.75rem; font-size: 1rem; }
.btn-google:hover { background: var(--gray-100); }

/* Login Page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-100); }

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.login-subtitle { color: var(--gray-500); margin-bottom: 2rem; }
.login-buttons { display: flex; flex-direction: column; gap: 0.75rem; }

/* Flash Messages */
.flash-messages { margin-bottom: 1rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Badge */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: var(--gray-100); color: var(--gray-500); }
.badge-active { background: #dcfce7; color: #166534; }
.badge-sold { background: #fef3c7; color: #92400e; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
.table th { background: var(--gray-50); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); }
.table tr.sold { opacity: 0.6; }
.table tbody tr:hover { background: var(--gray-50); }

/* Forms */
.form { background: white; padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.875rem; }
.form-group small { color: var(--gray-500); font-size: 0.8rem; }

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control-sm { max-width: 120px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }

.form-inline { display: flex; gap: 0.5rem; align-items: flex-end; background: white; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.form-inline .form-group { margin-bottom: 0; flex: 1; }

.inline-form { display: inline; }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* Fieldset */
.fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.fieldset legend { font-weight: 600; padding: 0 0.5rem; font-size: 0.9rem; }

.part-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; flex-wrap: wrap; }
.part-row .form-control { flex: 1; min-width: 100px; }

/* Filters */
.filters { margin-bottom: 1.5rem; }
.filter-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-form .form-group { margin-bottom: 0; }

/* Areas Grid */
.areas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.area-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
}
.area-card:hover { box-shadow: var(--shadow-md); }
.area-card h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.area-card h2 a { color: var(--gray-900); }
.area-count { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.25rem; }

.actions { display: flex; gap: 0.75rem; }

/* Detail Grid */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.detail-item { background: white; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); font-weight: 600; margin-bottom: 0.25rem; }
.detail-value { font-size: 1rem; }

.asset-description { background: white; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.asset-description h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }

/* Sections */
.section { margin-top: 2rem; }
.section h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-header h2 { margin-bottom: 0; }

/* Image Grid */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.image-card { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.image-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.image-actions { padding: 0.5rem; display: flex; align-items: center; justify-content: space-between; }
.image-name { font-size: 0.75rem; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }

.asset-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.asset-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.asset-card.sold {
    opacity: 0.8;
}

.asset-card-image-link {
    display: block;
    background: var(--gray-100);
}

.asset-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.asset-card-image-placeholder {
    width: 100%;
    height: 180px;
    display: grid;
    place-items: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    background: var(--gray-100);
}

.asset-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.asset-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.asset-card-header h2 {
    font-size: 1rem;
    line-height: 1.3;
}

.asset-card-header h2 a {
    color: var(--gray-900);
    text-decoration: none;
}

.asset-card-header h2 a:hover {
    color: var(--primary);
}

.asset-card-meta {
    display: grid;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-content h2 { margin-bottom: 1rem; }

/* Breadcrumb */
.breadcrumb { margin-bottom: 1rem; font-size: 0.875rem; }

/* Empty State */
.empty-state { color: var(--gray-500); text-align: center; padding: 2rem; }

.text-muted { color: var(--gray-500); font-size: 0.875rem; }

/* Responsive */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; gap: 1rem; }
    .nav-links { gap: 1rem; font-size: 0.875rem; }
    .container { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .filter-form { flex-direction: column; }
    .part-row { flex-direction: column; }
    .part-row .form-control { max-width: none; }
}

@media (max-width: 480px) {
    .nav-links { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .image-grid { grid-template-columns: 1fr; }
    .asset-cards { grid-template-columns: 1fr; }
}
