/* Custom Styles beyond Tailwind for finer control */

:root {
    --primary-blue: #0A66C2; /* Deeper LinkedIn-like blue */
    --secondary-blue: #0077B5; /* Slightly lighter blue */
    --accent-green: #28a745; /* Action green */
    --accent-red: #dc3545;   /* Danger red */
    --accent-gray: #6c757d;  /* Neutral gray */
    --light-bg: #f5f8fa;     /* Very light subtle background */
    --card-bg: #ffffff;
    --text-dark: #333d47;    /* Darker, softer text */
    --text-medium: #5a6b7d;  /* Medium gray for details */
    --border-light: #e0e6ec; /* Light border color */
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Header Styling */
.app-header {
    background: linear-gradient(to right, var(--primary-blue), var(--secondary-blue));
    color: #fff;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-header .logo {
    font-size: 1.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-header .user-name {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.1);
}

.app-header .header-btn {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

.app-header .header-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.app-header .header-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Specific colors for default header buttons - override base header-btn for custom colors */
.app-header .header-btn.users-btn { background-color: var(--accent-gray); border-color: rgba(255,255,255,0.2); }
.app-header .header-btn.users-btn:hover { background-color: #5a6268; }

/* New style for Bot Replies button */
.app-header .header-btn.prepared-replies-btn { /* Re-using this class name for Bot Replies */
    background-color: #f0ad4e; /* Orange color */
    border-color: rgba(255,255,255,0.2);
}
.app-header .header-btn.prepared-replies-btn:hover {
    background-color: #ec971f;
}

/* New style for FAQs button */
.app-header .header-btn.faqs-btn {
    background-color: #17a2b8; /* Cyan/Info blue color */
    border-color: rgba(255,255,255,0.2);
}
.app-header .header-btn.faqs-btn:hover {
    background-color: #138496;
}

.app-header .header-btn.settings-btn { background-color: var(--accent-green); border-color: rgba(255,255,255,0.2); }
.app-header .header-btn.settings-btn:hover { background-color: #218838; }

.app-header .header-btn.about-btn { background-color: #5bc0de; border-color: rgba(255,255,255,0.2); } /* Using a light blue for about */
.app-header .header-btn.about-btn:hover { background-color: #46b8da; }

.app-header .header-btn.logout-btn { background-color: var(--accent-red); border-color: rgba(255,255,255,0.2); }
.app-header .header-btn.logout-btn:hover { background-color: #c82333; }

/* Language Toggle Button Styling */
.app-header .header-btn.lang-toggle-btn {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}
.app-header .header-btn.lang-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
}


/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
}

/* Section Header */
.section-heading {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.section-heading .title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--primary-blue);
}

.section-heading .title-group i {
    font-size: 2rem;
}

.section-heading .button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Action Buttons (Refresh, Delete) */
.action-btn {
    background-color: var(--primary-blue);
    color: #fff;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background-color: var(--secondary-blue);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.refresh-btn {
    background-color: var(--accent-gray);
}
.action-btn.refresh-btn:hover {
    background-color: #5a6268;
}

.action-btn.delete-filtered-btn,
.action-btn.delete-closed-btn {
    background-color: var(--accent-red);
}
.action-btn.delete-filtered-btn:hover,
.action-btn.delete-closed-btn:hover {
    background-color: #c82333;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1rem;
    background-color: #eaf1f7;
    border-radius: 10px;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.03);
}

.filter-controls .filter-input,
.filter-controls .filter-select {
    flex-grow: 1;
    padding: 0.75rem 1.2rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: var(--card-bg);
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.filter-controls .filter-input::placeholder {
    color: var(--text-medium);
}

.filter-controls .filter-input:focus,
.filter-controls .filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.2);
    background-color: #fff;
}

.filter-controls .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236c757d'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 35px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-controls .apply-filter-btn {
    background-color: var(--primary-blue);
}
.filter-controls .apply-filter-btn:hover {
    background-color: var(--secondary-blue);
}

.filter-controls .clear-filter-btn {
    background-color: var(--accent-gray);
}
.filter-controls .clear-filter-btn:hover {
    background-color: #5a6268;
}


/* Conversations Grid */
#conversations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.75rem;
    padding-top: 1rem;
}

/* Conversation Card Styling */
.conversation-card {
    background-color: var(--card-bg);
    padding: 1.8rem;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 170px;
    position: relative;
}

.conversation-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-blue);
}

.conversation-card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-blue);
}

.conversation-card-details div {
    margin-bottom: 0.6rem;
    font-size: 1rem;
    color: var(--text-medium);
}

.conversation-card-details strong {
    color: var(--text-dark);
}

.conversation-card-details span {
    font-weight: normal;
    color: var(--text-medium);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
    border: 1px solid;
}

.status-open {
    background-color: #e6ffed;
    color: #1a7e3d;
    border-color: #b7e3c5;
}

.status-pending {
    background-color: #fff8e6;
    color: #8c6a0d;
    border-color: #ffe0b3;
}

.status-closed {
    background-color: #ffe6e6;
    color: #b22d36;
    border-color: #ffb3b3;
}

.status-archived {
    background-color: #e9eff4;
    color: #6a7c8c;
    border-color: #cdd8e4;
}

.status-default {
    background-color: #e9eff4;
    color: #6a7c8c;
    border-color: #cdd8e4;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-medium);
    margin-top: 1.2rem;
    text-align: left;
    border-top: 1px dashed var(--border-light);
    padding-top: 0.8rem;
}

/* Delete button on card */
.conversation-card .text-red-600 {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    background-color: #ffebeb;
    border-radius: 5px;
    align-self: flex-start;
    margin-top: 0.8rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.conversation-card .text-red-600:hover {
    background-color: #fce2e2;
    color: var(--accent-red);
    text-decoration: underline;
}


/* Empty state and Loading messages */
.status-message {
    text-align: center;
    padding: 2.5rem;
    font-size: 1.2rem;
    border-radius: 15px;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    box-shadow: var(--shadow-light);
}

.status-message i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.status-message.loading {
    color: var(--primary-blue);
    background-color: #e6f3ff;
    border: 1px solid #cce0f5;
}

.status-message.no-data {
    color: var(--text-medium);
    background-color: #fbfdff;
    border: 1px dashed var(--border-light);
}

.hidden {
    display: none !important;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem;
        margin: 1.5rem auto;
    }
    .app-header {
        padding: 1rem;
    }
    .app-header .user-info {
        gap: 0.8rem;
    }
    .app-header .header-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    .filter-controls {
        gap: 0.8rem;
        padding: 0.8rem;
    }
    .filter-controls .filter-input,
    .filter-controls .filter-select {
        max-width: unset;
        width: calc(50% - 0.4rem);
    }
    .filter-controls .action-btn {
        width: calc(50% - 0.4rem);
    }
    .section-heading {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .app-header .user-info {
        width: 100%;
        justify-content: center;
    }
    .main-content {
        padding: 1rem;
        margin: 1rem auto;
    }
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    .section-heading .button-group {
        width: 100%;
        justify-content: center;
    }
    .filter-controls {
        flex-direction: column;
    }
    .filter-controls .filter-input,
    .filter-controls .filter-select,
    .filter-controls .action-btn {
        width: 100%;
        max-width: none;
    }
    #conversations {
        grid-template-columns: 1fr;
    }
    .conversation-card {
        padding: 1.2rem;
        min-height: auto;
    }
    .status-message {
        padding: 1.5rem;
        font-size: 1rem;
    }
    .status-message i {
        font-size: 2rem;
    }
}