/**
 * app.css
 * Styles for the main app interface (header, sidebar, content area)
 */

/* ===== APP LAYOUT ===== */
body {
    min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    color: var(--text-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-medium);
}

/* ===== NOTIFICATIONS ===== */
.notification-wrapper {
    position: relative;
}

.notification-bell {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    position: relative;
}

.notification-bell:hover {
    background: var(--bg-light);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #DC2626;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 200;
    overflow: hidden;
    margin-top: 8px;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.notification-header .btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.notification-header .btn-link:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-item.notification-unread {
    background: #EFF6FF;
}

.notification-item.notification-unread:hover {
    background: #DBEAFE;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-medium);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.notification-dismiss {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.notification-item:hover .notification-dismiss {
    opacity: 1;
}

.notification-dismiss:hover {
    color: var(--text-dark);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 240px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: var(--space-md) 0;
    overflow-y: auto;
    z-index: 90;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    color: var(--text-medium);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background-color: var(--bg-light);
    color: var(--text-dark);
    text-decoration: none;
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.125rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 240px;
    margin-top: 60px;
    padding: var(--space-lg);
    min-height: calc(100vh - 60px);
}

.page-header {
    margin-bottom: var(--space-lg);
}

.page-header h2 {
    margin-bottom: var(--space-xs);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.stat-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-light);
    background-color: var(--bg-light);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background-color: var(--bg-light);
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions button {
    margin-right: var(--space-xs);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-state h3 {
    color: var(--text-medium);
    margin-bottom: var(--space-sm);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: var(--space-md);
}

.modal {
    position: relative;
    z-index: 201;
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
}

/* ===== PAGE HEADER ROW ===== */
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ===== SORTABLE TABLE HEADERS ===== */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable:hover {
    background-color: var(--border);
}

.sort-icon::after {
    content: '';
    display: inline-block;
    margin-left: 4px;
    opacity: 0.3;
}

.sortable.sort-asc .sort-icon::after {
    content: '▲';
    opacity: 1;
}

.sortable.sort-desc .sort-icon::after {
    content: '▼';
    opacity: 1;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
    padding: var(--space-md) var(--space-lg);
}

.filters-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.filter-group {
    min-width: 150px;
}

.filter-group .form-input {
    width: 100%;
}

/* ===== FORM ROWS ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ===== TEXTAREA ===== */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* ===== SMALL BUTTONS ===== */
.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
}

/* ===== ACTIVITY LIST ===== */
.activity-list {
    padding: 0;
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    background-color: var(--bg-light);
}

.activity-icon-success {
    background-color: var(--success-light);
}

.activity-icon-warning {
    background-color: var(--warning-light);
}

.activity-icon-danger {
    background-color: var(--danger-light);
}

.activity-icon-info {
    background-color: var(--primary-light);
}

.activity-icon-neutral {
    background-color: var(--neutral-200);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.9375rem;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.activity-details {
    font-size: 0.8125rem;
    color: var(--text-medium);
    margin-bottom: 4px;
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ===== TAGS ===== */
.tag-input-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-dark);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
    margin-left: 2px;
}

.tag-remove:hover {
    color: var(--danger);
}

/* ===== TEAM MEMBERS ===== */
.team-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.team-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
}

.team-member-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-member-info span {
    font-size: 0.875rem;
}

.pending-invite {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--warning-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
}

.badge-secondary {
    background-color: var(--bg-light);
    color: var(--text-medium);
}

/* ===== MARGIN UTILITIES ===== */
.mb-lg {
    margin-bottom: var(--space-lg);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background-color: var(--success);
}

.toast-error {
    background-color: var(--danger);
}

/* ===== PRICING GRID ===== */
.plan-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.plan-badge.trial {
    background-color: var(--primary-light);
    color: var(--primary);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.pricing-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.pricing-card.popular {
    border-color: var(--primary);
    border-width: 2px;
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

.pricing-card h4 {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.pricing-card .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.pricing-card .price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-light);
}

.price-annual {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: var(--space-md);
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0;
    text-align: left;
}

.plan-features li {
    padding: var(--space-xs) 0;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.plan-features li::before {
    content: '✓';
    color: var(--success);
    margin-right: var(--space-sm);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .user-name {
        display: none;
    }
    
    .header-logo {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-actions .btn {
        width: 100%;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}
