/* CloudSign Dashboard Styles */

body {
    background-color: #F8FAFC;
}

/* Shared authenticated application header. Keep this centralized so every
   logged-in screen presents the same brand and navigation treatment. */
.navbar {
    background: #ffffff;
    color: var(--primary-blue);
    border-bottom: 1px solid var(--primary-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar .navbar-brand a {
    height: auto;
    color: var(--primary-blue);
}

.navbar .navbar-brand img {
    width: 160px;
    height: auto;
    max-width: none;
    object-fit: contain;
}

/* Dashboard Navigation */
.dashboard-nav {
    display: none !important;
    gap: 1rem;
    flex: 1;
    margin: 0 1rem;
}

/* Page navigation lives in the authenticated sidebar. Do not duplicate
   Dashboard/Send/Back actions in the header. */
.navbar .nav-actions > .btn-secondary {
    display: none;
}

.dashboard-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: none;
    color: var(--primary-blue);
    font-weight: 700;
    transition: all 0.3s ease;
}

.dashboard-nav .nav-link:hover,
.dashboard-nav .nav-link.active {
    color: #003d99;
}

.dashboard-nav .nav-link.active {
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
}

.navbar .nav-actions .btn-secondary {
    color: var(--primary-blue);
    background: #ffffff;
    border-color: var(--primary-blue);
}

.navbar .nav-actions .btn-secondary:hover {
    color: #ffffff;
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(11, 83, 148, 0.2);
}

/* User Menu */
.user-menu {
    display: none;
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    box-shadow: 0 4px 12px rgba(11, 83, 148, 0.3);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    z-index: 1000;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown .dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--primary-blue);
    text-decoration: none;
    transition: all 0.3s ease;
}

.user-dropdown .dropdown-item:hover {
    background-color: var(--light-gray);
    color: var(--text-secondary);
}

.user-dropdown hr {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Dashboard Container */
.dashboard-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    background-color: white;
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-gray);
    margin: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-blue);
    padding-left: 2rem;
}

.sidebar-link.active {
    color: var(--primary-blue);
    background-color: rgba(11, 83, 148, 0.05);
    border-left: 3px solid var(--primary-blue);
}

.sidebar-link .icon {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 83, 148, 0.08);
    color: var(--primary-blue);
    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-link .badge {
    margin-left: auto;
    background-color: var(--error-red);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-divider {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    padding: 2rem;
    overflow-y: auto;
}

/* Welcome Section */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-purple) 100%);
    color: white;
    border-radius: 12px;
}

.welcome-content h1 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}

.welcome-content p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    min-height: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-blue);
    font-family: Arial, sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon,
.empty-state-icon {
    color: var(--primary-blue);
    font-family: Arial, sans-serif;
    font-weight: 800;
    letter-spacing: 0;
}

.action-icon {
    min-height: 2.5rem;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.stat-card h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    color: var(--text-gray);
    font-weight: 500;
    margin: 0.5rem 0;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0.5rem 0;
}

.stat-number.loading-value {
    font-size: 1rem;
    color: var(--text-secondary);
}

.loading-value {
    color: inherit;
    opacity: 0.75;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

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

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.link-text {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.link-text:hover {
    color: var(--accent-purple);
}

/* Activity Section */
.activity-section,
.pending-section,
.actions-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.activity-list,
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item,
.pending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.activity-item:hover,
.pending-item:hover {
    background-color: var(--light-gray);
}

.activity-info,
.pending-info {
    flex: 1;
}

.activity-title,
.pending-title {
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 0.25rem 0;
}

.activity-meta,
.pending-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.activity-status,
.pending-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-badge {
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.completed {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success-green);
}

.status-badge.pending {
    background-color: rgba(255, 152, 0, 0.1);
    color: #FF9800;
}

.status-badge.declined {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--error-red);
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.action-card:hover {
    border-color: var(--primary-blue);
    background-color: rgba(11, 83, 148, 0.05);
    transform: translateY(-4px);
}

.action-card h3 {
    font-size: 1rem;
    margin: 0.5rem 0;
    color: var(--dark-gray);
}

.action-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Loading Placeholder */
.loading-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading-placeholder p {
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin: 0.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .navbar {
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .navbar-container {
        min-height: 88px;
        justify-content: center;
        padding: 0.75rem 1rem;
    }

    .navbar .navbar-brand img {
        width: min(210px, 70vw);
    }

    .navbar .nav-actions {
        position: absolute;
        right: 0.75rem;
        top: 0.75rem;
    }

    .dashboard-container {
        display: block;
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .sidebar {
        display: block;
        position: sticky;
        top: 88px;
        z-index: 19;
        height: auto;
        padding: 0.5rem 0;
        overflow-y: visible;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-header,
    .sidebar-divider {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0.4rem;
        padding: 0 0.75rem;
        min-width: max-content;
    }

    .sidebar-link {
        flex: 0 0 auto;
        gap: 0.4rem;
        min-height: 44px;
        padding: 0.65rem 0.85rem;
        border: 1px solid transparent;
        border-radius: 999px;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .sidebar-link:hover {
        padding-left: 0.85rem;
    }

    .sidebar-link.active {
        border-left: 0;
        border-color: rgba(11, 83, 148, 0.22);
        background-color: rgba(11, 83, 148, 0.09);
    }

    .sidebar-link .icon {
        width: 1.15rem;
        height: 1.15rem;
        font-size: 0.66rem;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0));
    }

    .welcome-section {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
        margin-bottom: 1.5rem;
        padding: 1.5rem 1rem;
        border-radius: 14px;
    }

    .welcome-content h1 {
        font-size: clamp(1.65rem, 8vw, 2.25rem);
        line-height: 1.15;
    }

    .welcome-content p {
        font-size: 1rem;
        line-height: 1.45;
    }

    .welcome-section .btn-primary-large {
        width: 100%;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dashboard-nav {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        min-height: 165px;
        padding: 1.1rem 0.75rem;
    }

    .activity-section,
    .pending-section,
    .actions-section {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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

@media (max-width: 420px) {
    .navbar-container {
        min-height: 80px;
    }

    .sidebar {
        top: 80px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        min-height: 150px;
    }

    .stat-card h3 {
        font-size: 0.82rem;
    }

    .stat-icon {
        min-height: 1.8rem;
        margin-bottom: 0.45rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }
}
