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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #e74c3c;
    --accent-color: #f39c12;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --gray-light: #ecf0f1;
    --gray-medium: #95a5a6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --nav-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    background-image: url('graphics/app_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

.page-content {
    flex: 1;
    padding: 20px;
    padding-bottom: calc(var(--nav-height) + 20px);
    overflow-y: auto;
}

.page-content.no-padding {
    padding: 0;
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px 20px;
}

.login-logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.login-form {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.register-link {
    margin-top: 20px;
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s;
}

.register-link:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--gray-light);
}

.divider span {
    background: var(--white);
    padding: 0 10px;
    position: relative;
    color: var(--gray-medium);
    font-size: 0.9rem;
}

.btn-scan-login {
    width: 100%;
    padding: 14px;
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.login-qr-reader {
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #c0392b;
}

/* Profile Page */
.profile-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
}

.profile-header h2 {
    color: var(--white);
    font-size: 1.8rem;
}

.profile-info {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    font-weight: 600;
    color: var(--gray-medium);
}

.info-item .value {
    font-weight: 500;
    color: var(--primary-color);
}

.qr-container {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.qr-container h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

#qrCode {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

#qrCode canvas {
    max-width: 100%;
    height: auto !important;
}

.btn-install {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: none;
    margin-bottom: 15px;
}

.btn-install:hover {
    background: #d68910;
}

.btn-install:active {
    transform: scale(0.98);
}

.btn-logout {
    width: 100%;
    padding: 14px;
    background: var(--white);
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

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

/* Page Header */
.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    color: var(--white);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.page-header .subtitle {
    color: var(--gray-medium);
    font-size: 0.95rem;
}

.search-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 10px;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Exhibitors List */
.exhibitors-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.exhibitor-card {
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.exhibitor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.exhibitor-card h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.exhibitor-card p {
    color: var(--gray-medium);
    font-size: 0.9rem;
}

/* Exhibitor Detail */
.back-btn {
    background: var(--gray-light);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.exhibitor-detail {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.exhibitor-logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.exhibitor-logo-container img {
    max-width: 200px;
    max-height: 150px;
    object-fit: contain;
}

.exhibitor-detail h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.exhibitor-detail p {
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 25px;
}

.exhibitor-detail h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--gray-light);
}

/* Products List */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-item {
    background: var(--gray-light);
    border-radius: 10px;
    padding: 15px;
}

.product-item h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-item p {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.rating-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.star {
    font-size: 1.8rem;
    cursor: pointer;
    color: #ddd;
    transition: color 0.2s;
    user-select: none;
}

.star.active {
    color: var(--accent-color);
}

/* Notebook */
.notebook-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notebook-item {
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.notebook-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.notebook-item h4 {
    color: var(--primary-color);
    flex: 1;
}

.notebook-item .exhibitor-name {
    color: var(--gray-medium);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.notebook-item p {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.rating-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.notebook-item .rating-container {
    flex: 1;
}

.btn-remove-rating {
    background: transparent;
    color: var(--secondary-color);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px 10px;
    border-radius: 5px;
}

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

.btn-remove-rating:active {
    transform: scale(0.9);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-medium);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Map */
.map-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.map-btn {
    background: var(--white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

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

.map-container {
    background: var(--white);
    overflow: hidden;
    position: relative;
    height: calc(100vh - 280px);
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

.map-container svg {
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.1s ease-out;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    transition: color 0.3s;
    padding: 8px 15px;
    flex: 1;
}

.nav-item .icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.nav-item .label {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--secondary-color);
}

.nav-item:hover {
    color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 480px) {
    .logo-container h1 {
        font-size: 1.6rem;
    }

    .login-form {
        padding: 20px;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .nav-item .icon {
        font-size: 1.3rem;
    }

    .nav-item .label {
        font-size: 0.7rem;
    }
}

/* QR Scanner */
.qr-reader {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.qr-results {
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 60px;
    box-shadow: var(--shadow);
    text-align: center;
    color: var(--gray-medium);
}

.qr-results.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.qr-results.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.btn-stop-scan {
    width: 100%;
    padding: 14px;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-stop-scan:hover {
    background: #c0392b;
}

.btn-stop-scan:active {
    transform: scale(0.98);
}

/* Logo Home */
.logo-container-home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100vh - var(--nav-height) - 40px);
    text-align: center;
    padding: 40px 20px 20px;
}

.app-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.color-squares {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
    align-items: center;
}

.square {
    width: 65px;
    height: 65px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.square:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.square-1 {
    background-color: #e74c3c;
}

.square-2 {
    background-color: #3498db;
}

.square-3 {
    background-color: #2ecc71;
}

.square-4 {
    background-color: #f39c12;
}

.square-5 {
    background-color: #9b59b6;
}

/* PWA specific */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}
