/* ========================================
   MANUALI DIGITALI - Style
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* ---- APP NATIVE FEEL ---- */
button, a, label, nav, .toolbar-title, .badge-active, .login-footer {
    -webkit-user-select: none;
    user-select: none;
}
img { -webkit-user-drag: none; }
body { -webkit-tap-highlight-color: transparent; }

/* ---- LOGIN PAGE ---- */
.login-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(20px + env(safe-area-inset-left, 0px));
    padding-right: calc(20px + env(safe-area-inset-right, 0px));
}
.login-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 16px;
}
.login-form .pin-input-group {
    margin-bottom: 16px;
}
.login-footer {
    margin-top: 24px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}
.login-footer p { margin: 0; }

/* ---- VIEWER PAGE ---- */
.viewer-page {
    background: #525659;
    overflow: hidden;
    height: 100vh;
}
.viewer-toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 100;
}
.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.toolbar-logo {
    height: 28px;
}
.toolbar-title {
    color: #fff;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}
.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    margin: 0 4px;
}
.btn-toolbar {
    color: #cbd5e1;
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
}
.btn-toolbar:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.btn-toolbar:disabled {
    color: #475569;
    cursor: default;
}
.btn-toolbar:disabled:hover {
    background: none;
}
.page-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-size: 0.85rem;
}
.page-number-input {
    width: 48px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    color: #fff;
    text-align: center;
    font-size: 0.85rem;
    padding: 4px;
}
.page-number-input:focus {
    outline: none;
    border-color: #3b82f6;
}
.page-separator {
    color: #94a3b8;
}
.zoom-display {
    color: #cbd5e1;
    font-size: 0.8rem;
    min-width: 42px;
    text-align: center;
}
.viewer-container {
    position: fixed;
    top: calc(52px + env(safe-area-inset-top, 0px));
    left: 0; right: 0; bottom: 0;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: none;
}
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #525659;
    color: #cbd5e1;
    z-index: 50;
}
.touch-zone {
    position: fixed;
    top: calc(52px + env(safe-area-inset-top, 0px));
    bottom: 0;
    width: 60px;
    z-index: 10;
    cursor: pointer;
}
.touch-left { left: 0; }
.touch-right { right: 0; }

@media (min-width: 768px) {
    .touch-zone { display: none; }
}

/* ---- ADMIN PAGE ---- */
.admin-page {
    background: #f1f5f9;
    min-height: 100vh;
}
.admin-navbar {
    background: #1e293b;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-navbar h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}
.admin-navbar a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
}
.admin-navbar a:hover {
    color: #fff;
}
.admin-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}
.admin-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.admin-card h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}
.admin-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #334155;
    vertical-align: middle;
}
.admin-table tbody tr:hover {
    background: #f8fafc;
}
.badge-active {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #dcfce7;
    color: #166534;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 767px) {
    .admin-content { padding: 12px; }
    .admin-card { padding: 16px; }
    .login-card { padding: 30px 20px; }
    .toolbar-title { max-width: 120px; }
}
