/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn-primary {
    display: inline-block;
    background-color: #5B21B6;
    color: white;
    padding: 12px 28px;
    border-radius: 30px;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #4C1D95;
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-block;
    background-color: white;
    color: #000;
    padding: 12px 28px;
    border-radius: 30px;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: #f5f5f5;
    border-color: #5B21B6;
    color: #5B21B6;
}

.btn-danger {
    display: inline-block;
    background-color: #f8f8f8;
    color: #dc3545;
    padding: 10px 24px;
    border-radius: 30px;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid #f0f0f0;
    font-size: 14px;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Landing Page */
.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-header {
    background-color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.landing-header h1 {
    font-size: 2.5em;
    color: #007bff;
}

.landing-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.landing-content {
    text-align: center;
    max-width: 800px;
}

.landing-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.feature {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.feature h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.landing-cta {
    margin-top: 40px;
}

.landing-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    color: #007bff;
    font-size: 2em;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-control:focus {
    outline: none;
    border-color: #5B21B6;
}

button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    background-color: #5B21B6;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

button[type="submit"]:hover {
    background-color: #4C1D95;
    transform: translateY(-1px);
}

/* Dashboard */
.dashboard-container {
    min-height: 100vh;
    background-color: #fafafa;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #000;
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
}

.topbar-brand a {
    color: white;
    text-decoration: none;
}

.topbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 5px;
}

.topbar-nav li {
    margin: 0;
}

.topbar-nav a {
    display: block;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
}

.topbar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.topbar-nav a.active {
    background-color: #5B21B6;
    color: white;
    font-weight: 500;
}

.topbar-logout {
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
    background-color: #fafafa;
}

/* Breadcrumbs */
.breadcrumbs {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    position: fixed;
    top: 60px; /* Height of topbar */
    left: 0;
    right: 0;
    z-index: 999;
}

.breadcrumbs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

.breadcrumbs ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 15px 0;
    align-items: center;
    font-size: 14px;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: '/';
    margin: 0 10px;
    color: #9ca3af;
}

.breadcrumbs a {
    color: #6b7280;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: #5B21B6;
}

.breadcrumbs .current {
    color: #111827;
    font-weight: 500;
}

.dashboard-header {
    background: white;
    padding: 25px 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    border: 1px solid #f0f0f0;
}

.dashboard-header h1 {
    display: inline-block;
    font-size: 28px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

.header-actions {
    float: right;
}

/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.card-header h2,
.card-header h3 {
    color: #000;
    font-weight: 600;
    margin: 0;
}

.card-header > div {
    display: flex;
    gap: 10px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

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

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: normal;
}

.stat-number {
    font-size: 32px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

/* App Cards */
.app-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    border: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-color: #5B21B6;
}

.app-card-icon {
    flex-shrink: 0;
}

.app-card-content {
    flex: 1;
}

.app-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.card-grid .card {
    margin-bottom: 0;
    transition: all 0.2s;
}

.card-grid .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-color: #5B21B6;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -5px;
    padding: 0 5px;
}

.table-responsive .table {
    min-width: 800px; /* Minimum width to prevent cramping */
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap; /* Prevent text wrapping in cells */
}

.table td:first-child,
.table td:last-child {
    white-space: normal; /* Allow wrapping for User ID and Actions */
}

.table th {
    background-color: #fafafa;
    font-weight: 600;
    color: #000;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    color: #333;
    font-size: 14px;
}

.table tr:hover {
    background-color: #fafafa;
}

.table tbody tr[onclick],
.table tbody tr.clickable-row {
    cursor: pointer;
    transition: all 0.2s;
}

.table tbody tr[onclick]:hover,
.table tbody tr.clickable-row:hover {
    background-color: #f5f5f5;
    transform: translateX(2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

/* Code blocks in modals */
.modal pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    margin-right: 12px;
}

.status.active {
    background-color: #10b981;
    color: white;
}

.status.paused {
    background-color: #f59e0b;
    color: white;
}

.status.completed {
    background-color: #3b82f6;
    color: white;
}

/* Weight Badge */
.weight-badge {
    display: inline-block;
    background-color: #f3f4f6;
    color: #374151;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* App search */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 10px;
}

/* Implementation Flow */
.implementation-flow {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.implementation-flow ol {
    margin: 10px 0;
    padding-left: 20px;
}

.implementation-flow li {
    margin: 8px 0;
    line-height: 1.6;
}

.implementation-flow ul {
    margin: 10px 0 10px 20px;
    padding-left: 20px;
}

.implementation-flow code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.875rem;
    color: #5B21B6;
}

/* Responsive - iPad Landscape */
@media (max-width: 1024px) {
    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .table .btn-danger {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .topbar-container {
        padding: 0 15px;
    }
    
    .topbar-brand h1 {
        font-size: 18px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .topbar-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #000;
        flex-direction: column;
        padding: 10px 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .topbar-nav.show {
        display: flex;
    }
    
    .topbar-nav li {
        width: 100%;
    }
    
    .topbar-nav a {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 0;
    }
    
    .topbar-logout {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 10px;
        padding-top: 10px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
}