/* Admin Dashboard Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

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

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

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

.login-box h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
}

.login-box .subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90d9;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background-color: #4a90d9;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: #3a7bc8;
}

.login-btn:active {
    background-color: #2d6bb5;
}

.error-message {
    background-color: #fee;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

/* Dashboard Styles (for future use) */
.dashboard-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-header h1 {
    font-size: 24px;
    color: #333;
}

.dashboard-header .subtitle {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

.dashboard-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-content h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

/* Navigation Bar */
.nav-bar {
    background: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.nav-brand {
    font-size: 18px;
    font-weight: 600;
    color: #4a90d9;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    transition: opacity 0.3s;
}

.sidebar-overlay-active {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: white;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar-open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0 4px;
}

.sidebar-close:hover {
    color: #333;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-link {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: #f0f7ff;
    color: #4a90d9;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
}

.sidebar-user {
    font-weight: 500;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: #4a90d9;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.nav-logout {
    color: #dc3545;
    text-decoration: none;
}

.nav-logout:hover {
    text-decoration: underline;
}

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

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 600;
    color: #4a90d9;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.detail-card h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.detail-card h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

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

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

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

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

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 8px 0;
    font-size: 14px;
}

.info-table td:first-child {
    color: #666;
    width: 40%;
}

.info-table td:last-child {
    color: #333;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background-color: #e9ecef;
    color: #6c757d;
}

.badge-primary {
    background-color: #cce5ff;
    color: #004085;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Buttons */
.btn-small {
    display: inline-block;
    padding: 6px 12px;
    background-color: #4a90d9;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background-color: #3a7bc8;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

.btn-primary {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4a90d9;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #3a7bc8;
}

/* Action Links */
.action-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-link {
    display: inline-block;
    padding: 12px 20px;
    background-color: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid #ddd;
    transition: all 0.2s;
}

.action-link:hover {
    background-color: #4a90d9;
    color: white;
    border-color: #4a90d9;
}

/* Forms */
.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-vertical .form-group {
    margin-bottom: 0;
}

.form-vertical textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.form-vertical textarea:focus {
    outline: none;
    border-color: #4a90d9;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.form-vertical select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.portal-inline-form {
    margin: 0;
}

.nav-logout-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.portal-stacked-form {
    margin-top: 16px;
}

.portal-detail-grid {
    align-items: start;
}

.portal-message-card {
    max-width: 720px;
    margin: 40px auto 0;
}

.portal-nav-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-nav-menu a {
    color: #4a90d9;
    text-decoration: none;
    font-size: 14px;
}

.portal-nav-menu a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .portal-nav-menu {
        display: flex;
    }
}

/* Messages */
.empty-message {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.success-message {
    color: #155724;
    background-color: #d4edda;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 16px;
}

.back-link {
    margin-top: 20px;
}

.back-link a {
    color: #4a90d9;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Dashboard Section */
.dashboard-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.dashboard-section h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.report-text-block {
    white-space: pre-line;
    color: #333;
    line-height: 1.5;
    background: #f8fafc;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0 16px;
}

/* Table scroll wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
    }

    .container {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

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

    .filters-section {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .filter-group select {
        flex: 1;
        min-width: 0;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }

    .action-links {
        flex-direction: column;
    }

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

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form select {
        min-width: 0;
        width: 100%;
    }

    .pagination {
        flex-direction: column;
        gap: 10px;
    }

    .message {
        max-width: 95%;
    }

    .dashboard-header h1 {
        font-size: 20px;
    }

    .dashboard-section,
    .dashboard-content,
    .conversation-container,
    .funnel-section,
    .detail-card {
        padding: 14px;
    }

    .funnel-stage {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 12px;
    }

    .info-table td:first-child {
        width: 45%;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 12px;
    }

    .btn-primary {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Conversation History */
.conversation-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    max-width: 80%;
}

.message-user {
    background-color: #e3f2fd;
    margin-left: auto;
    text-align: right;
}

.message-assistant {
    background-color: #f5f5f5;
    margin-right: auto;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.message-role {
    font-weight: 600;
    color: #666;
}

.message-time {
    color: #999;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-meta {
    margin-top: 8px;
    font-size: 11px;
    color: #999;
}

.message-meta span {
    margin-right: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagination-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4a90d9;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.pagination-link:hover {
    background-color: #3a7bc8;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* Filter Section */
.filters-section {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #555;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: #4a90d9;
}

/* Funnel Section */
.funnel-section {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.funnel-section h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.funnel-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.funnel-stage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.funnel-stage:last-child {
    border-bottom: none;
}

.stage-name {
    font-size: 14px;
    color: #555;
}

.stage-count {
    font-size: 18px;
    font-weight: 600;
    color: #4a90d9;
}
