:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --accent: #f72585;
    --light-accent: #ffb4d9;
    --dark: #212529;
    --light: #f8f9fa;
    --gray: #6c757d;
    --success: #4cc9f0;
    --danger: #e63946;
    --yellow: #ffd166;
    --transition: all 0.3s ease;
}

.dark-mode {
    --primary: #4cc9f0;
    --secondary: #7209b7;
    --accent: #f72585;
    --light-accent: #ff6bce;
    --dark: #f8f9fa;
    --light: #1a1a2e;
    --gray: #ced4da;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: var(--transition);
}

body {
    background-color: var(--light);
    color: var(--dark);
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(90deg, #fff, var(--light-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.container {
    width: 95%;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--secondary);
}

.actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray);
    border-radius: 34px;
    transition: var(--transition);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.dark-mode-label {
    margin-left: 0.5rem;
    font-weight: 500;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4);
}

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

.btn-success:hover {
    box-shadow: 0 5px 15px rgba(76, 201, 240, 0.4);
}

.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.filter-select,
.filter-date {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    color: var(--dark);
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
}

th {
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    color: var(--dark);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-family: 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
}

.edit-btn {
    background-color: var(--yellow);
    color: var(--dark);
}

.delete-btn {
    background-color: var(--danger);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.platform-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.platform-instagram {
    background-color: #E1306C;
    color: white;
}

.platform-youtube {
    background-color: #FF0000;
    color: white;
}

.platform-tiktok {
    background-color: #000000;
    color: white;
}

.platform-facebook {
    background-color: #3b5998;
    color: white;
}

.platform-linkedin {
    background-color: #0077B5;
    color: white;
}

.platform-pinterest {
    background-color: #BD081C;
    color: white;
}

.platform-twitter {
    background-color: #1DA1F2;
    color: white;
}

.platform-threads {
    background-color: #000000;
    color: white;
}

.platform-snapchat {
    background-color: #FFFC00;
    color: #000;
}

.platform-whatsapp-channel {
    background-color: #25D366;
    color: white;
}

.platform-reddit {
    background-color: #FF4500;
    color: white;
}

.platform-shopee {
    background-color: #EE4D2D;
    color: white;
}

.platform-lazada {
    background-color: #003EE5;
    color: white;
}

.truncate {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Allow wrapping in truncated table cells */
#contentTableWrapper td.truncate {
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word;
    word-break: break-word;
}

/* Spinner Overlay */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.spinner-overlay.hidden {
    display: none;
}
.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav { display: none; }
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--light);
        border-top: 1px solid #ddd;
        z-index: 1500;
    }
    .mobile-bottom-nav button {
        flex: 1;
        border: none;
        background: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0;
        color: var(--dark);
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    .mobile-bottom-nav button i {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    /* Hide top header on mobile */
    header {
        display: none;
    }
    /* Keep title: hide only dashboard-header buttons */
    .dashboard-header > button {
        display: none;
    }
}

/* List Entries Modal styling */
.modal#listModal .list-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.modal#listModal .list-group ul li {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.modal#listModal .list-group ul li:hover {
    background: var(--light);
}

/* Dark mode container & text overrides */
.dark-mode .filters,
.dark-mode .table-container,
.dark-mode .modal-content {
    background-color: #16213e;
    color: var(--dark);
}

.dark-mode .form-control,
.dark-mode .filter-select,
.dark-mode .filter-date {
    background-color: #0f3460;
    border-color: #1a1a2e;
    color: white;
}

.dark-mode td,
.dark-mode th {
    border-color: #1a1a2e;
}

.dark-mode .filter-label,
.dark-mode .form-label,
.dark-mode .dark-mode-label {
    color: var(--dark);
}

/* Footer styling */
.footer {
    text-align: center;
    padding: 1rem 0;
    background: var(--light);
    color: var(--dark);
    font-size: 0.875rem;
}
.dark-mode .footer {
    background: var(--dark);
    color: var(--light);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Info Modal Contact Button */
.modal#infoModal .modal-content .contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem auto;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}
.modal#infoModal .modal-content .contact-btn i {
    font-size: 1.25rem;
}

/* Info Modal enhancements */
.modal#infoModal .modal-content h2 {
    margin-bottom: 1rem;
}
.modal#infoModal .modal-content p:first-of-type {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}
.modal#infoModal .modal-content .form-buttons {
    margin-bottom: 1.5rem;
}
.modal#infoModal .modal-content p.text-muted a {
    color: var(--primary);
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .actions {
        width: 100%;
        justify-content: space-between;
    }
    .table-container {
        overflow-x: auto;
    }
    .btn {
        padding: 0.6rem 1rem;
    }
}
