* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.page {
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-card h1 {
    margin: 0 0 30px;
    text-align: center;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #e53935;
    color: white;
}

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

.btn-success {
    background: #43a047;
    color: white;
}

.btn-success:hover {
    background: #388e3c;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    background: white;
    min-height: 100vh;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.dashboard-header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 24px;
}

.dashboard-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dashboard-nav a, .dashboard-nav button {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.dashboard-nav a:hover, .dashboard-nav button:hover {
    background: rgba(255,255,255,0.3);
}

.dashboard-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* PVZ Cards */
.pvz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pvz-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

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

.pvz-card.status-open {
    border-left-color: #43a047;
}

.pvz-card.status-closed {
    border-left-color: #e53935;
}

.pvz-card.status-unknown {
    border-left-color: #9e9e9e;
}

.pvz-card h3 {
    margin: 0 0 10px;
}

.pvz-card .address {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.pvz-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-dot.open {
    background: #43a047;
}

.status-dot.closed {
    background: #e53935;
}

.status-dot.unknown {
    background: #9e9e9e;
}

.pvz-times {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* Kiosk Page */
.kiosk-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #1a1a2e;
    color: white;
}

.kiosk-card {
    background: #16213e;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.kiosk-status {
    font-size: 24px;
    margin-bottom: 20px;
}

.kiosk-status .status-text {
    font-weight: 700;
    font-size: 32px;
}

.kiosk-status.open .status-text {
    color: #4caf50;
}

.kiosk-status.closed .status-text {
    color: #f44336;
}

.kiosk-status.unknown .status-text {
    color: #9e9e9e;
}

.kiosk-qr {
    background: white;
    padding: 20px;
    border-radius: 16px;
    display: inline-block;
    margin: 20px 0;
}

.kiosk-qr img {
    max-width: 300px;
    height: auto;
}

.kiosk-action-label {
    font-size: 20px;
    margin-top: 20px;
    opacity: 0.9;
}

.kiosk-connection {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #aaa;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.connection-dot.connected {
    background: #4caf50;
}

.connection-dot.disconnected {
    background: #f44336;
}

.kiosk-time {
    margin-top: 10px;
    font-size: 14px;
    opacity: 0.7;
}

/* Mobile Confirmation Page */
.mobile-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.mobile-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.mobile-card h1 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #333;
}

.mobile-card .pvz-name {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 30px;
}

.mobile-card .action-type {
    font-size: 48px;
    margin-bottom: 20px;
}

.mobile-card .confirm-btn {
    width: 100%;
    padding: 20px;
    font-size: 20px;
    margin-top: 20px;
}

.mobile-card .confirm-btn.open {
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
}

.mobile-card .confirm-btn.close {
    background: linear-gradient(135deg, #e53935 0%, #ef5350 100%);
}

.mobile-success {
    color: #43a047;
}

.mobile-error {
    color: #e53935;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* Telegram Link */
.telegram-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.telegram-section h3 {
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-code {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 4px;
    font-family: monospace;
}

.link-instructions {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.link-instructions ol {
    padding-left: 20px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .dashboard-header-content {
        flex-direction: column;
        gap: 15px;
    }

    .auth-card {
        padding: 30px 20px;
    }

    .pvz-grid {
        grid-template-columns: 1fr;
    }

    .kiosk-qr img {
        max-width: 250px;
    }
}

/* Add PVZ button */
.add-pvz-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
}

/* Section header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Token display */
.token-display {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
    margin: 15px 0;
}

.token-warning {
    background: #fff3e0;
    color: #e65100;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 10px;
}
