/* styles.css */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --primary-light: #e3f2fd;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-color: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

.container { max-width: 100%; margin: 0 auto; padding: 0 16px; }

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; color: var(--primary-color); flex-shrink: 0; }
.logo-icon { width: 28px; height: 28px; flex-shrink: 0; }
.logo-text { white-space: nowrap; }

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    justify-content: space-between;
    min-width: 0;
}
.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-right { margin-left: auto; }

.nav-btn {
    padding: 8px 16px; background: transparent; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
    cursor: pointer; transition: var(--transition); text-decoration: none; display: inline-block;
    white-space: nowrap;
}
.nav-btn:hover { background: var(--bg-secondary); border-color: var(--primary-color); color: var(--primary-color); }
.nav-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.main { padding: 24px 0; }

/* Main tabs */
.main-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}
.main-tabs .tab {
    padding: 10px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.main-tabs .tab:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.main-tabs .tab.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Search */
.search-section {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.search-box { display: flex; gap: 8px; margin-bottom: 16px; }
.search-input {
    flex: 1; padding: 12px 16px; border: 2px solid var(--border-color);
    border-radius: var(--radius-md); font-size: 16px; transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary-color); }
.search-btn {
    padding: 12px 20px; background: var(--primary-color); border: none;
    border-radius: var(--radius-md); color: white; cursor: pointer;
    transition: var(--transition); display: flex; align-items: center; justify-content: center;
}
.search-btn:hover { background: var(--primary-hover); }
.search-btn svg { width: 20px; height: 20px; }

.filters-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-md);
    cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-secondary);
    transition: var(--transition);
    user-select: none;
}
.filters-toggle:hover { background: var(--bg-tertiary); }
.filters-toggle svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.filters-toggle.active svg { transform: rotate(180deg); }

.filters-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.filters-panel.active { max-height: 500px; margin-top: 16px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary-color); }

.filters-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Results */
.results-section {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-sm);
}
.results-header { margin-bottom: 20px; }
.results-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.results-list { display: flex; flex-direction: column; gap: 16px; }

.room-card {
    display: flex; gap: 16px; padding: 16px; background: var(--bg-secondary);
    border-radius: var(--radius-md); cursor: pointer; transition: var(--transition);
    border: 1px solid transparent;
}
.room-card:hover { border-color: var(--primary-color); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.room-photo {
    width: 120px; height: 120px; border-radius: var(--radius-sm);
    overflow: hidden; flex-shrink: 0; background: var(--bg-tertiary);
    display: flex; align-items: center; justify-content: center;
}
.room-photo img { width: 100%; height: 100%; object-fit: cover; }
.room-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.room-number { font-size: 20px; font-weight: 600; color: var(--primary-color); }
.room-meta { font-size: 14px; color: var(--text-secondary); }
.room-description {
    font-size: 14px; color: var(--text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.room-updated { font-size: 12px; color: var(--text-muted); margin-top: auto; }

.contact-card {
    display: flex; gap: 16px; padding: 16px; background: var(--bg-secondary);
    border-radius: var(--radius-md); cursor: pointer; transition: var(--transition);
    border: 1px solid transparent;
}
.contact-card:hover { border-color: var(--primary-color); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.contact-photo {
    width: 120px; height: 120px; border-radius: var(--radius-sm);
    overflow: hidden; flex-shrink: 0; background: var(--bg-tertiary);
    display: flex; align-items: center; justify-content: center;
}
.contact-photo img { width: 100%; height: 100%; object-fit: cover; }
.contact-info { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.contact-name { font-size: 20px; font-weight: 600; color: var(--primary-color); }
.contact-meta { font-size: 14px; color: var(--text-secondary); }
.contact-notes {
    font-size: 14px; color: var(--text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.contact-phones {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 14px; color: var(--text-primary);
    margin-top: 4px;
}
.contact-phones-label { font-weight: 500; color: var(--text-secondary); font-size: 13px; }
.contact-phone { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

.contact-emails {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 14px; color: var(--text-primary);
    margin-top: 4px;
}
.contact-emails-label { font-weight: 500; color: var(--text-secondary); font-size: 13px; }
.contact-email { word-break: break-all; }

.contact-updated { font-size: 12px; color: var(--text-muted); margin-top: auto; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto;
    position: relative; animation: slideUp 0.3s ease;
}
.modal-content.modal-large { max-width: 90vw; }
.modal-content.modal-confirm { max-width: 420px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close {
    position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
    background: var(--bg-secondary); border: none; border-radius: 50%;
    font-size: 24px; color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; z-index: 1;
}
.modal-close:hover { background: var(--bg-tertiary); }
.modal-body { padding: 24px; }
.modal-body h2 { margin-bottom: 20px; }
.modal-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius-md); margin-bottom: 20px; }
.modal-title { font-size: 24px; font-weight: 600; color: var(--primary-color); margin-bottom: 16px; }
.modal-details { display: flex; flex-direction: column; gap: 12px; }
.modal-detail { display: flex; gap: 12px; }
.modal-detail-label { font-weight: 500; color: var(--text-secondary); min-width: 140px; }
.modal-detail-value { color: var(--text-primary); word-break: break-word; }
.modal-detail-value a { color: var(--primary-color); text-decoration: none; }
.modal-detail-value a:hover { text-decoration: underline; }
.modal-phone { font-family: ui-monospace, 'SF Mono', Menlo, monospace; line-height: 1.8; }
.modal-description { margin-top: 20px; padding: 16px; background: var(--bg-secondary); border-radius: var(--radius-md); }
.modal-updated { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); font-size: 13px; color: var(--text-muted); }

.confirm-text { color: var(--text-secondary); font-size: 15px; margin-bottom: 20px; }

/* Pagination */
.pagination {
    display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap;
}
.pagination button {
    padding: 8px 14px; background: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-size: 14px;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); }
.pagination button.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Login */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.login-card {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h2 { margin-bottom: 8px; color: var(--text-primary); }
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.login-card .form-group { text-align: left; }
.login-card .btn-primary { margin-top: 8px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    text-align: left;
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

/* User badge */
.user-badge {
    padding: 6px 12px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.user-badge small { opacity: 0.7; font-weight: 400; }

/* Placeholder */
.placeholder-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-tertiary);
}
.room-photo .placeholder-img,
.contact-photo .placeholder-img {
    border-radius: var(--radius-sm);
}
.modal-photo.placeholder-img {
    border-radius: var(--radius-md);
    max-height: 300px;
}

/* Buttons */
.btn {
    padding: 10px 20px; border: none; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
.form-label.required::after { content: ' *'; color: #dc3545; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border-color);
    border-radius: var(--radius-md); font-size: 15px; transition: var(--transition);
    font-family: inherit; background: var(--bg-primary); color: var(--text-primary);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary-color); }
.form-textarea { min-height: 100px; resize: vertical; }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        height: auto;
        padding: 10px 0;
        flex-wrap: wrap;
    }
    .logo-text { font-size: 16px; }
    .nav {
        flex: 1 0 100%;
        gap: 12px;
        justify-content: space-between;
    }
    .nav-left, .nav-right { gap: 6px; }
    .nav-btn { padding: 6px 10px; font-size: 13px; }
    .user-badge { font-size: 12px; padding: 4px 8px; }

    .main-tabs { gap: 6px; padding-bottom: 12px; }
    .main-tabs .tab { padding: 8px 12px; font-size: 13px; }

    .search-section { padding: 16px; }
    .filters-grid { grid-template-columns: 1fr; }
    .filters-actions { flex-direction: column; }
    .filters-actions .btn { width: 100%; justify-content: center; }

    .room-card, .contact-card { flex-direction: column; }
    .room-photo, .contact-photo { width: 100%; height: 200px; }

    .modal-content { max-height: 95vh; }
    .modal-body { padding: 16px; }
    .modal-detail { flex-direction: column; gap: 4px; }
    .modal-detail-label { min-width: auto; font-size: 13px; }
}