/* ============ VARIABLES ============ */
:root {
    --primary-color: #00A884;
    --secondary-color: #008069;
    --tertiary-color: #075E54;
    --background-color: #f0f2f5;
    --card-hover-color: #ffffff;
    --text-color: #111B21;
    --gradient-start: #00A884;
    --gradient-end: #008069;
    --message-background: #FFFFFF;
    --success-green: #00A884;
    --gradient-primary: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ============ LOGIN SCREEN ============ */
.logingrid {
    background: linear-gradient(135deg, var(--tertiary-color) 0%, var(--primary-color) 100%);
    min-height: 100vh;
}

.logingrid .ui.card {
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.logingrid .ui.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 168, 132, 0.3);
}

.login-logo i {
    color: white !important;
}

.logingrid .ui.green.button {
    background: var(--gradient-primary) !important;
    transition: all 0.3s ease;
}

.logingrid .ui.green.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.logingrid .ui.teal.button {
    background: linear-gradient(135deg, var(--secondary-color), var(--tertiary-color)) !important;
    transition: all 0.3s ease;
}

.logingrid .ui.teal.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(7, 94, 84, 0.4);
}

/* ============ HEADERS ============ */
.menu-header,
.main-header {
    background: var(--gradient-primary);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
}

.header-title {
    font-size: 1.4rem;
    font-weight: 700;
}

/* ============ NAVIGATION ============ */
.header-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-item {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.85;
}

.nav-item i {
    font-size: 1em;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
    transform: translateY(-1px);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

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

.header-right .button {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    border-radius: 50px !important;
    padding: 0.6rem 1.5rem !important;
    text-transform: none !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.header-right .button:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.header-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right .ui.button {
    transition: all 0.3s ease;
}

.header-right .ui.button:hover {
    transform: translateY(-1px);
}

/* ============ ADMIN VIEW ============ */
.admingrid .ui.segment {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.admingrid .ui.table {
    border-radius: 8px;
    overflow: hidden;
}

.admingrid .ui.table thead th {
    background: linear-gradient(135deg, var(--tertiary-color), var(--secondary-color));
    color: white;
    font-weight: 500;
}

.admingrid .ui.table tbody tr:hover {
    background-color: rgba(0, 168, 132, 0.05);
}

/* Instance Status Labels */
.ui.label.green {
    background-color: var(--primary-color) !important;
}

/* ============ MAIN DASHBOARD ============ */
#instance-info {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 3px solid var(--primary-color);
}

#instance-info .ui.button {
    margin: 0.2rem;
}

/* Dashboard Cards */
.ui.cards > .card.widget,
.ui.card.widget {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    border-top: 3px solid transparent;
}

.ui.cards > .card.widget:hover,
.ui.card.widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    border-top-color: var(--primary-color);
}

.ui.cards > .card.widget .header,
.ui.card.widget .header {
    font-size: 1rem !important;
    font-weight: 600 !important;
}

.ui.cards > .card.widget .meta,
.ui.card.widget .meta {
    color: #888 !important;
    font-size: 0.85rem !important;
}

.ui.cards > .card.widget .ui.green.button {
    background: var(--gradient-primary) !important;
    transition: all 0.3s ease;
}

.ui.cards > .card.widget .ui.green.button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============ QR CODE ============ */
#qrcode-container img {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#pair-code-container .ui.header {
    font-family: 'Fira Code', monospace;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ GROUPS MANAGER ============ */
#groupsMainContainer .ui.segment {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.group-list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.group-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.group-list-item .group-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.group-list-item .group-info {
    flex: 1;
    min-width: 0;
}

.group-list-item .group-info .group-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-list-item .group-info .group-meta {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.2rem;
}

.group-list-item .group-type-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-type-badge.normal {
    background: rgba(0, 168, 132, 0.1);
    color: var(--primary-color);
}

.group-type-badge.community {
    background: rgba(52, 183, 241, 0.1);
    color: #34b7f1;
}

.group-type-badge.community-group {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

/* ============ GROUP DETAILS MODAL ============ */
#groupDetailsPhoto {
    border: 3px solid var(--primary-color);
    transition: all 0.3s ease;
}

#groupDetailsPhoto:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 168, 132, 0.3);
}

.participant-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.participant-item:last-child {
    border-bottom: none;
}

.participant-item .participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    color: #666;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.participant-item .participant-info {
    flex: 1;
}

.participant-item .participant-info .participant-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.participant-item .participant-info .participant-role {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.participant-item .participant-actions {
    display: flex;
    gap: 0.3rem;
}

/* ============ MODALS ============ */
.ui.modal {
    border-radius: 12px !important;
}

.ui.modal > .header {
    background: var(--gradient-primary) !important;
    color: white !important;
    border-radius: 12px 12px 0 0 !important;
}

.ui.modal > .actions {
    border-radius: 0 0 12px 12px !important;
}

.ui.modal .ui.green.button,
.ui.modal .ui.green.approve.button {
    background: var(--gradient-primary) !important;
}

/* ============ TOAST NOTIFICATIONS ============ */
.ui.toast-container {
    z-index: 10000 !important;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-title {
        font-size: 1rem;
    }

    .ui.cards > .card.widget {
        margin: 0.5rem 0 !important;
    }

    #instance-info .ui.grid > .column {
        text-align: center !important;
    }

    .group-list-item {
        flex-wrap: wrap;
    }

    .group-list-item .group-type-badge {
        margin-top: 0.5rem;
    }

    #adminActionsSection .ui.button {
        margin-bottom: 0.3rem;
    }
}

@media (max-width: 480px) {
    .logingrid .column {
        padding: 1rem !important;
    }

    .ui.container {
        padding: 0 0.5rem;
    }
}

/* ============ ANIMATION CLASSES ============ */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.widget {
    animation: slideIn 0.4s ease forwards;
    opacity: 0;
}

.widget:nth-child(1) { animation-delay: 0.03s; }
.widget:nth-child(2) { animation-delay: 0.06s; }
.widget:nth-child(3) { animation-delay: 0.09s; }
.widget:nth-child(4) { animation-delay: 0.12s; }
.widget:nth-child(5) { animation-delay: 0.15s; }
.widget:nth-child(6) { animation-delay: 0.18s; }
.widget:nth-child(7) { animation-delay: 0.21s; }
.widget:nth-child(8) { animation-delay: 0.24s; }
.widget:nth-child(9) { animation-delay: 0.27s; }
.widget:nth-child(10) { animation-delay: 0.30s; }
.widget:nth-child(11) { animation-delay: 0.33s; }
.widget:nth-child(12) { animation-delay: 0.36s; }
.widget:nth-child(n+13) { animation-delay: 0.40s; }

/* ============ WIDGET CARDS HOVER ============ */
.ui.cards > .card.widget {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border-top: 3px solid transparent !important;
}

.ui.cards > .card.widget:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 25px rgba(0, 168, 132, 0.18) !important;
    border-top-color: var(--primary-color) !important;
}

.ui.cards > .card.widget .header {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

/* ============ CHECK PHONE RESULT ============ */
#checkPhoneData .item {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============ BROADCAST TABS ============ */
#broadcastTabs .item,
#newsletterTabs .item {
    font-size: 0.9em !important;
    padding: 0.6em 1em !important;
}

/* ============ HISTORY / RESULT CODE BLOCKS ============ */
pre#historyData,
pre#bizProfileData,
pre#nlInfoData,
pre#nlCreateData {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 11px;
    line-height: 1.5;
}

/* ============ MODAL HEADER GRADIENT ============ */
.ui.modal > .header {
    background: linear-gradient(135deg, var(--tertiary-color), var(--primary-color)) !important;
    color: #fff !important;
    border-bottom: none !important;
}

.ui.modal > .header i.icon {
    color: #fff !important;
}

/* ============ STATUS BADGE PULSE ============ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#instance-status.green {
    animation: pulse 2.5s ease infinite;
}

/* ============ MISC ============ */
.ui.green.label {
    background-color: var(--primary-color) !important;
}

.ui.teal.label {
    background-color: var(--secondary-color) !important;
}

.ui.red.label {
    background-color: #e74c3c !important;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Copy button style */
.copy-btn {
    cursor: pointer;
    transition: color 0.2s;
}

.copy-btn:hover {
    color: var(--primary-color);
}

/* Blocklist items */
#blocklist .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

/* Contacts list */
#contactsList .item {
    padding: 0.6rem 0;
}

#contactsList .item .header {
    font-weight: 500 !important;
}

#contactsList .item .description {
    color: #888 !important;
    font-size: 0.85rem !important;
}

/* ============ INSTANCE TABLE ============ */
#instances-table td code {
    background: rgba(0,168,132,0.1);
    color: var(--tertiary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82em;
}

/* ============ QR CODE CONTAINER ============ */
#qrcode-container img {
    transition: opacity 0.3s ease;
}

/* ============ PAIR CODE ============ */
#pair-code-value {
    font-family: 'Courier New', monospace !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5rem !important;
    color: var(--primary-color) !important;
    background: rgba(0,168,132,0.08);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: 2px dashed var(--primary-color);
    display: inline-block;
}
