/* ============================================================
   DocConta Client Portal - App Layout Styles
   Extends docconta.css for mobile-first client portal
   ============================================================ */

/* Client theme is defined in docconta.css as [data-theme="cliente"] */
/* No overrides needed here — all colors come from CSS variables */

/* ---- Tap highlight ---- */
* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: contain; }

/* ---- Safe area for notched devices ---- */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---- App Header ---- */
.dc-app-header {
    height: 56px;
    background: var(--dc-bg-card);
    border-bottom: 1px solid var(--dc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.dc-app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.dc-app-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--dc-green), var(--dc-green-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.dc-app-header-info {
    min-width: 0;
}

.dc-app-header-info h1 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dc-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-app-header-info p {
    font-size: 12px;
    color: var(--dc-text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-app-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ---- App Body ---- */
.dc-app-body {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 56px);
}

/* ---- App Sidebar (desktop) ---- */
.dc-app-sidebar {
    display: none;
    width: 220px;
    background: var(--dc-bg-sidebar);
    border-right: 1px solid var(--dc-border);
    padding: 12px 8px;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .dc-app-sidebar {
        display: flex;
    }
}

.dc-app-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--dc-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.dc-app-nav-item:hover {
    background: var(--dc-bg-hover);
    color: var(--dc-text);
}

.dc-app-nav-item.active {
    background: var(--dc-green-glow);
    color: var(--dc-green);
}

.dc-app-nav-item svg {
    flex-shrink: 0;
}

.dc-app-nav-spacer {
    flex: 1;
    min-height: 20px;
}

.dc-app-nav-logout:hover {
    color: var(--dc-red) !important;
}

/* ---- Nav Badges ---- */
.dc-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    background: var(--dc-green);
    color: #fff;
    line-height: 1;
    margin-left: auto;
}

.dc-nav-badge-red {
    background: var(--dc-red);
}

.dc-nav-badge-float {
    position: absolute;
    top: -4px;
    right: -8px;
    margin-left: 0;
}

/* ---- Main Content ---- */
.dc-app-main {
    flex: 1;
    min-width: 0;
    padding-bottom: 80px; /* space for bottom nav */
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .dc-app-main {
        padding-bottom: 24px;
    }
}

/* ---- Bottom Navigation (mobile) ---- */
.dc-app-bottomnav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
    background: var(--dc-bg-card);
    border-top: 1px solid var(--dc-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 1024px) {
    .dc-app-bottomnav {
        display: none;
    }
}

.dc-app-bottomnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    color: var(--dc-text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.2s;
    min-width: 0;
}

.dc-app-bottomnav-item.active {
    color: var(--dc-green);
}

.dc-app-bottomnav-item:hover {
    color: var(--dc-text);
}

.dc-app-bottomnav-fab {
    width: 48px;
    height: 48px;
    background: var(--dc-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(0,200,150,0.3);
}

.dc-app-bottomnav-center span {
    color: var(--dc-text-dim);
    font-size: 10px;
}

/* ---- Page Content ---- */
.dc-page-content {
    padding: 16px;
    max-width: 720px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .dc-page-content {
        padding: 24px;
    }
}

.dc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.dc-page-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

/* ---- Document Type Icons ---- */
.doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-icon-nf     { background: rgba(59,130,246,0.15); color: #60a5fa; }
.doc-icon-guia   { background: rgba(239,68,68,0.15); color: #f87171; }
.doc-icon-recibo { background: rgba(0,200,150,0.15); color: var(--dc-green); }
.doc-icon-contra { background: rgba(168,85,247,0.15); color: #c084fc; }
.doc-icon-balanco { background: rgba(245,158,11,0.15); color: #fbbf24; }
.doc-icon-outros { background: var(--dc-bg-hover); color: var(--dc-text-dim); }

/* ---- Document Cards ---- */
.dc-doc-card {
    background: var(--dc-bg-card);
    border: 1px solid var(--dc-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.dc-doc-card:hover {
    border-color: rgba(0,200,150,0.3);
    box-shadow: 0 4px 16px rgba(0,200,150,0.05);
}

.dc-doc-card.unread {
    border-left: 3px solid var(--dc-green);
}

.dc-doc-card-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.dc-doc-card-body {
    flex: 1;
    min-width: 0;
}

.dc-doc-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dc-text);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dc-doc-card-sub {
    font-size: 12px;
    color: var(--dc-text-muted);
    margin: 2px 0 0;
}

.dc-doc-card-obs {
    font-size: 12px;
    color: var(--dc-blue);
    font-style: italic;
    margin: 6px 0 0;
}

.dc-doc-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.dc-doc-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

/* ---- Unread dot ---- */
.dc-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--dc-green);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- Urgency dots ---- */
.dc-urgency-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dc-urgency-dot-red { background: var(--dc-red); }
.dc-urgency-dot-yellow { background: var(--dc-yellow); }
.dc-urgency-dot-grey { background: var(--dc-grey); }

/* ---- Due date text ---- */
.text-due-overdue { color: var(--dc-red); font-weight: 500; }
.text-due-soon { color: var(--dc-yellow); font-weight: 500; }
.text-due-ok { color: var(--dc-text-muted); }

/* ---- Skeleton Loading ---- */
.dc-skeleton {
    background: var(--dc-bg-hover);
    border-radius: 6px;
    animation: dc-pulse 1.5s ease-in-out infinite;
}

@keyframes dc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Empty state (extend docconta.css) ---- */
.dc-empty svg {
    width: 56px;
    height: 56px;
}

/* ---- Accordion ---- */
.dc-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.dc-accordion-content.open {
    max-height: 2000px;
}

.dc-accordion-icon {
    transition: transform 0.3s ease;
}

.dc-accordion-icon.open {
    transform: rotate(180deg);
}

/* ---- Modal Overlay (mobile bottom sheet style) ---- */
.dc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: dc-fade-in 0.2s ease-out;
}

@media (min-width: 1024px) {
    .dc-overlay {
        align-items: center;
    }
}

.dc-overlay .dc-modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    animation: dc-slide-up 0.3s ease-out;
}

@media (min-width: 1024px) {
    .dc-overlay .dc-modal {
        border-radius: 16px;
    }
}

@keyframes dc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dc-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ---- Progress Bar ---- */
.dc-progress {
    width: 100%;
    background: var(--dc-border);
    border-radius: 3px;
    overflow: hidden;
    height: 6px;
}

.dc-progress-bar {
    height: 100%;
    background: var(--dc-green);
    border-radius: 3px;
    transition: width 0.3s ease-out;
}

/* ---- Misc helpers ---- */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden { display: none !important; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-danger { color: var(--dc-red); }
.text-warning { color: var(--dc-yellow); }
.text-success { color: var(--dc-green); }
.text-info { color: var(--dc-blue); }
.text-muted { color: var(--dc-text-muted); }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.w-full { width: 100%; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.text-center { text-align: center; }

/* ---- PWA standalone mode ---- */
@media (display-mode: standalone) {
    .dc-app-header { padding-top: env(safe-area-inset-top, 0); }
}

/* ---- Print ---- */
@media print {
    .dc-app-header, .dc-app-sidebar, .dc-app-bottomnav, #toast-container, .dc-btn { display: none !important; }
    body { background: white; color: black; }
    .dc-app-main { padding: 0; }
}
