/* Storage app — base styles (production bundle will replace/extend) */

/* ── Storage app active ──────────────────────────────────────────────── */
#wa-app.storage-wa-app {
    position: relative;
    z-index: 9999;
}

/* ── Boot spinner ────────────────────────────────────────────────────── */
.storage-boot {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
}

.storage-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: storage-spin 0.7s linear infinite;
}

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

/* ── Height chain ─────────────────────────────────────────────────────── */
/* Frontend: full viewport */
#storage-frontend-wrap {
    height: 100vh;
    overflow: hidden;
    background: #f9fafb;
}
#storage-frontend-wrap #storage-app {
    height: 100%;
}
/* Backend: fill the Webasyst content area */
#content #storage-app,
#wa-app #storage-app {
    height: 100%;
}
/* Backend: make storage fill the full height (including wa-2.0 context) */
.storage-backend-content {
    overflow: hidden !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}
.storage-backend-content #storage-app {
    flex: 1 !important;
    overflow: hidden !important;
    min-height: 0 !important;
}
/* Make parent chain fill viewport in backend */
body:has(.storage-backend-content) #wa {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important;
    overflow: hidden !important;
}
body:has(.storage-backend-content) #wa-app {
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
}
body:has(.storage-backend-content) {
    overscroll-behavior: none;
}
/* Override Webasyst 2.0 global .sidebar styles inside our app */
#storage-app .sidebar {
    position: relative !important;
    top: 0 !important;
    height: 100% !important;
    overflow: visible !important;
    width: auto !important;
}

/* ── Темы для auth/share страниц ────────────────────────────────────── */
:root, [data-theme="light"] {
    --auth-bg:          #f3f4f6;
    --auth-card-bg:     #ffffff;
    --auth-card-shadow: 0 4px 24px rgba(0,0,0,.08);
    --auth-text:        #111827;
    --auth-label:       #374151;
    --auth-muted:       #6b7280;
    --auth-border:      #d1d5db;
    --auth-input-bg:    #ffffff;
    --auth-error-bg:    #fef2f2;
    --auth-error-text:  #dc2626;
    --auth-error-bdr:   #fca5a5;
    --auth-ok-bg:       #f0fdf4;
    --auth-ok-text:     #16a34a;
    --auth-ok-bdr:      #86efac;
    --auth-accent:      #6366f1;
    --auth-accent-h:    #4f46e5;
}
[data-theme="dark"] {
    --auth-bg:          #0f172a;
    --auth-card-bg:     #1e293b;
    --auth-card-shadow: 0 4px 24px rgba(0,0,0,.4);
    --auth-text:        #f1f5f9;
    --auth-label:       #cbd5e1;
    --auth-muted:       #94a3b8;
    --auth-border:      #334155;
    --auth-input-bg:    #263348;
    --auth-error-bg:    #450a0a;
    --auth-error-text:  #f87171;
    --auth-error-bdr:   #7f1d1d;
    --auth-ok-bg:       #064e3b;
    --auth-ok-text:     #34d399;
    --auth-ok-bdr:      #065f46;
    --auth-accent:      #818cf8;
    --auth-accent-h:    #6366f1;
}

/* ── Server-rendered auth / share pages ──────────────────────────────── */
.auth-page, .share-page {
    background: var(--auth-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}
.auth-wrapper, .share-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}
.auth-card, .share-card {
    background: var(--auth-card-bg);
    border-radius: 12px;
    box-shadow: var(--auth-card-shadow);
    padding: 32px;
    color: var(--auth-text);
}
.share-card {
    padding: 12px;
}
.auth-logo, .share-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--auth-accent);
    margin-bottom: 20px;
    justify-content: center;
}
.auth-logo-img {
    max-height: 30px;
    max-width: 180px;
    object-fit: contain;
    display: block;
}
.auth-logo-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--auth-accent);
}
.auth-title { margin: 0 0 20px; font-size: 20px; font-weight: 600; text-align: center; color: var(--auth-text); }
.auth-input {
    display: block; width: 100%; box-sizing: border-box;
    padding: 9px 12px; margin: 4px 0 12px;
    border: 1px solid var(--auth-border); border-radius: 8px;
    font-size: 14px; outline: none;
    background: var(--auth-input-bg); color: var(--auth-text);
}
.auth-input:focus { border-color: var(--auth-accent); }
.auth-btn {
    display: block; width: 100%; padding: 10px;
    background: var(--auth-accent); color: #fff; border: none;
    border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: center; text-decoration: none;
    margin-top: 4px;
}
.auth-btn:hover { background: var(--auth-accent-h); }
.auth-error {
    background: var(--auth-error-bg); color: var(--auth-error-text);
    border: 1px solid var(--auth-error-bdr); border-radius: 8px;
    padding: 10px 14px; font-size: 13px; margin-bottom: 14px; text-align: center;
}
.auth-success {
    background: var(--auth-ok-bg); color: var(--auth-ok-text);
    border: 1px solid var(--auth-ok-bdr); border-radius: 8px;
    padding: 12px 14px; font-size: 13px; text-align: center;
}
.auth-links {
    display: flex; justify-content: space-between;
    margin-top: 14px; font-size: 13px;
}
.auth-links a { color: var(--auth-accent); text-decoration: none; }
.auth-page label, .share-page label { font-size: 13px; font-weight: 500; color: var(--auth-label); }
.share-filename { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.share-meta { color: #6b7280; font-size: 13px; margin-bottom: 16px; }
.share-download { display: inline-block; width: auto; padding: 10px 24px; }
.share-protected { color: #374151; margin-bottom: 12px; }
.share-notfound { color: #6b7280; text-align: center; font-size: 15px; }
.share-view-only { color: #9ca3af; font-size: 13px; text-align: center; }
