/* Main Stylesheet - Imports modular CSS files for better maintainability */

/* Import base styles (variables, themes, general layout) */
@import url('base.css');

/* Import component styles (buttons, forms, modals, cards) */
@import url('components.css');

/* Import layout styles (navigation, containers) */
@import url('layout.css');

/* Import page-specific styles (cart, products, chat, etc.) */
@import url('pages.css');

/* Import responsive styles */
@import url('responsive.css');

/* Employee Chat Styles - Added for chat functionality */
.employee-chat-wrapper {
    display: flex;
    height: calc(100vh - 140px);
    background: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: 20px auto;
    max-width: 1200px;
}

.chat-sidebar {
    width: 350px;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    background: var(--primary);
    color: white;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.status-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.status-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .status-slider {
    background-color: var(--accent);
}

input:checked + .status-slider:before {
    transform: translateX(26px);
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
}

.conversation-item:hover {
    background: var(--background-light);
}

.conversation-item.active {
    background: var(--primary-light);
    border-right: 3px solid var(--primary);
}

.conversation-avatar {
    position: relative;
    margin-left: 15px;
    flex-shrink: 0;
}

.avatar-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid white;
}

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-preview {
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.end-chat-btn {
    padding: 5px;
    border: none;
    background: none;
    color: var(--danger);
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.end-chat-btn:hover {
    background: var(--danger-light);
    color: white;
}

.no-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.no-conversations-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-conversations p {
    margin: 10px 0 5px 0;
    font-size: 16px;
    color: var(--text);
}

.no-conversations small {
    font-size: 12px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-user-info {
    display: flex;
    align-items: center;
}

.chat-avatar {
    margin-left: 15px;
}

.chat-details h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--text);
}

.chat-status {
    font-size: 12px;
    color: var(--accent);
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-action-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--background);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background: var(--secondary-light);
    border-color: var(--primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--background-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.chat-placeholder h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--text);
}

.chat-placeholder p {
    margin: 0;
    font-size: 14px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    margin-bottom: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

.message.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message.sent .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 4px 14px rgba(5, 129, 255, 0.35);
    text-align: right;
}

.message.received .message-content {
    background: #f8f9fb;
    color: var(--text);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.message.sent .message-time {
    text-align: right;
}

/* Improved add_product.php admin layout */
.admin-panel {
    max-width: 1180px;
    margin: 1.75rem auto 2rem;
    padding: 1.75rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(68, 84, 96, 0.12);
}

.admin-panel .section-title {
    font-size: 1.65rem;
    margin-bottom: 1rem;
    color: #1f2a44;
}

.admin-forms-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.form-container {
    background: #fafbfd;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    padding: 1.25rem;
}

.form-container h2 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 0.95rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #334a6f;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid #ccd7ea;
    background: #fff;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
    color: #0f1829;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(51, 102, 255, 0.14);
}

.form-container button {
    width: 100%;
    border: none;
    padding: 0.75rem 0.95rem;
    border-radius: 9px;
    font-size: 0.98rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.form-container button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(30, 112, 255, 0.23);
}

.table-container {
    background: #ffffff;
    border: 1px solid #d7dee9;
    border-radius: 14px;
    padding: 1rem;
    overflow-x: auto;
    box-shadow: 0 10px 24px rgba(69, 90, 106, 0.09);
}

.table-container h2 {
    margin-bottom: .85rem;
    font-size: 1.15rem;
    color: #2c3e50;
}

.admin-submenu {
    display: inline-flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-submenu a {
    padding: 0.5rem 0.8rem;
    border: 1px solid #d4e2f5;
    border-radius: 8px;
    background: #f7faff;
    color: #2a4270;
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 600;
    transition: all .2s ease;
}

.admin-submenu a:hover {
    background: #deecff;
    border-color: #96c5ff;
    color: #1b325a;
}

.admin-submenu a.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #ffffff;
}


.admin-panel table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.admin-panel thead th {
    text-align: right;
    padding: 11px 12px;
    background: #f4f7fb;
    color: #2e3f57;
    font-weight: 600;
    border-bottom: 2px solid #e1e8f2;
}

.admin-panel td {
    padding: 10px 12px;
    border-bottom: 1px solid #e6ecf4;
    color: #2f3f5a;
}

.admin-panel tr:nth-child(even) {
    background: #fbfcfd;
}

.product-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #d9dee6;
    margin-right: .6rem;
}

.admin-panel button {
    padding: 0.52rem 0.78rem;
    font-size: 0.84rem;
    border-radius: 8px;
    border: 1px solid #b3c3dc;
    background: #eaf0fb;
    color: #2f4a75;
}

.admin-panel button:hover {
    background: #dce6f8;
}

@media(max-width: 1024px) {
    .admin-forms-grid { grid-template-columns: 1fr; }
}

@media(max-width: 768px) {
    .admin-panel { padding: 1rem; }
    .table-container { padding: 0.85rem; }
    .admin-panel table { min-width: 100%; }
}


.message.received .message-time {
    text-align: left;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.message-form {
    margin-bottom: 10px;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chatMessage {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    resize: none;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.4;
    min-height: 40px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s ease;
}

#chatMessage:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.send-btn {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

.loading-messages {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.error-message {
    text-align: center;
    color: var(--danger);
    padding: 20px;
    background: var(--danger-light);
    border-radius: 8px;
    margin: 20px;
}

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .employee-chat-wrapper {
        flex-direction: column;
        height: calc(100vh - 160px);
        margin: 10px;
    }

    .chat-sidebar {
        width: 100%;
        height: 200px;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }

    .conversations-list {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 0;
    }

    .conversation-item {
        flex-shrink: 0;
        width: 200px;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        margin-right: 10px;
    }

    .conversation-item:last-child {
        border-right: none;
        margin-right: 20px;
    }

    .message {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .employee-chat-wrapper {
        margin: 5px;
        height: calc(100vh - 140px);
    }

    .sidebar-header,
    .chat-header {
        padding: 15px;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-input-area {
        padding: 15px;
    }

    .conversation-item {
        padding: 10px 15px;
        width: 180px;
    }

    .avatar-circle {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .conversation-name {
        font-size: 13px;
    }

    .conversation-preview {
        font-size: 11px;
    }
}