/* Global Styles */
body {
    font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
    margin: 0;
    color: #111;
    background-color: #f8f9fa;
    font-weight: 400;
    line-height: 1.6;
}

header {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 16px;
}

a {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0a58ca;
}

nav a {
    margin-right: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

nav a:hover {
    background-color: #f8f9fa;
}

.card {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 32px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    background-color: #f8f9fa;
    border-color: #999;
}

.btn-primary {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background: #0a58ca;
    border-color: #0a58ca;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.muted {
    color: #666;
    font-size: 14px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

input,
select,
textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 100%;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

input[type="number"] {
    width: auto;
    min-width: 80px;
}

/* Grid Layouts */
.form-grid {
    display: grid;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 120px;
}

.form-grid-4 {
    grid-template-columns: 1fr 1fr 160px 120px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

th,
td {
    border-bottom: 1px solid #eee;
    padding: 12px 8px;
    text-align: left;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-inactive {
    background-color: #f8f9fa;
    color: #6c757d;
}

.status-active {
    background-color: #d1edff;
    color: #0d6efd;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-started {
    background-color: #cff4fc;
    color: #055160;
}

.status-login-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-upvote-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-completed {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-already-upvoted {
    background-color: #e2e3e5;
    color: #41464b;
}

.status-invalid-credentials {
    background-color: #f8d7da;
    color: #721c24;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.toast {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    margin-bottom: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #28a745;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-info {
    border-left: 4px solid #17a2b8;
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #333;
}

.toast-body {
    font-size: 14px;
    color: #666;
}

/* Error Messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-bottom: 16px;
    font-size: 14px;
}

.success-message {
    background-color: #d1e7dd;
    color: #0f5132;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #badbcc;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    nav a {
        margin-right: 8px;
        padding: 6px 10px;
    }

    .toast {
        min-width: 280px;
        max-width: 320px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

/* Icon Alignment */
i[data-feather] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Navigation Icons */
nav a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

nav a i[data-feather] {
    width: 16px;
    height: 16px;
}

/* Button Icons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn i[data-feather] {
    width: 16px;
    height: 16px;
}

/* Small Button Icons */
.btn[style*="font-size: 12px"] i[data-feather] {
    width: 14px;
    height: 14px;
}

/* Heading Icons */
h1,
h2,
h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

h1 i[data-feather],
h2 i[data-feather],
h3 i[data-feather] {
    width: 20px;
    height: 20px;
}

/* Inline Icons */
strong {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

strong i[data-feather] {
    width: 14px;
    height: 14px;
}

/* Post Detail Page Styles */
.post-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 24px;
}

.post-info-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.post-info-section h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #495057;
    font-weight: 600;
    font-size: 16px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 8px;
}

.info-item strong {
    min-width: 80px;
    font-weight: 500;
    color: #6c757d;
    font-size: 14px;
}

.info-item span {
    flex: 1;
    color: #212529;
    font-size: 14px;
}

.progress-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.progress-bar-container {
    background-color: #e9ecef;
    border-radius: 6px;
    height: 12px;
    margin-top: 18px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #28a745, #20c997);
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Status Legend Grid */
.status-legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.status-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.status-legend-item .status-badge {
    flex-shrink: 0;
}

.status-legend-item .muted {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

/* Modal Styles */
.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: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-icon {
    width: 24px;
    height: 24px;
    color: #dc3545;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.modal-body {
    margin-bottom: 24px;
    color: #6c757d;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-btn:hover {
    background-color: #f8f9fa;
    border-color: #999;
}

.modal-btn-primary {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.modal-btn-primary:hover {
    background: #c82333;
    border-color: #c82333;
}

.modal-btn-secondary {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.modal-btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

/* Table URL styling */
table td a[target="_blank"] {
    word-break: break-all;
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Table responsive behavior */
table {
    table-layout: fixed;
    width: 100%;
}

table th:nth-child(1) {
    width: 20%;
}

/* Name */
table th:nth-child(2) {
    width: 35%;
}

/* URL */
table th:nth-child(3) {
    width: 15%;
}

/* Progress */
table th:nth-child(4) {
    width: 15%;
}

/* Status */
table th:nth-child(5) {
    width: 15%;
}

/* Actions */

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .status-legend-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    .modal {
        padding: 24px;
        margin: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-btn {
        justify-content: center;
    }

    /* Mobile table adjustments */
    table th:nth-child(1) {
        width: 25%;
    }

    /* Name */
    table th:nth-child(2) {
        width: 40%;
    }

    /* URL */
    table th:nth-child(3) {
        width: 15%;
    }

    /* Progress */
    table th:nth-child(4) {
        width: 10%;
    }

    /* Status */
    table th:nth-child(5) {
        width: 10%;
    }

    /* Actions */

    table td a[target="_blank"] {
        max-width: 120px;
    }
}

/* Assigned Accounts */
.assigned-accounts-table table th:nth-child(1) {
    width: 40%;
}

.assigned-accounts-table table th:nth-child(2) {
    width: 25%;
}

.assigned-accounts-table table th:nth-child(3) {
    width: 10%;
}

.assigned-accounts-table table th:nth-child(4) {
    width: 20%;
}

.assigned-accounts-table table th:nth-child(5) {
    width: 25%;
}

/* Accounts Table */
.accounts-table table th:nth-child(1) {
    width: 40%;
}

.accounts-table table th:nth-child(2) {
    width: 15%;
}

.accounts-table table th:nth-child(3) {
    width: 25%;
}

.accounts-table table th:nth-child(4) {
    width: 20%;
}

/* Provider Grid */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.provider-card {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.provider-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.provider-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.provider-info {
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-label {
    font-weight: 600;
    margin-right: 8px;
    min-width: 80px;
    color: #666;
}

.info-item code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #d63384;
}

.provider-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.provider-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Accounts Table Header */
.table-header {
    margin-bottom: 16px;
}

.table-header h4 {
    margin: 0;
}