/* caller-interface.css */
/* Custom Styles for Caller Interface */
.caller-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1e1e2d;
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    font-family: "Poppins", sans-serif;
}

.caller-interface.active {
    display: flex;
    opacity: 1;
}

.caller-interface.minimized {
    width: 380px;
    height: 120px;
    top: auto;
    bottom: 20px;
    right: 20px;
    left: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 10001;
}

.caller-interface.ringing {
    width: 500px;
    height: 500px;
    top: 20px;
    right: 20px;
    left: auto;
    bottom: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: pulse-ringing 1.5s infinite;
}

@keyframes pulse-ringing {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.caller-interface.answered {
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    border-radius: 0;
    box-shadow: none;
}

.minimized-view {
    display: none;
    width: 100%;
    height: 100%;
    background: #1b1b28;
    border-radius: 12px;
    padding: 15px;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.minimized-view.active {
    display: flex;
}

.minimized-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3699ff 0%, #8950fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.minimized-info {
    flex: 1;
    overflow: hidden;
}

.minimized-name {
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.minimized-phone {
    color: #9296a5;
    font-size: 14px;
}

.minimized-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.minimized-timer {
    color: #9296a5;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.status-dot.ringing {
    background: #f59e0b;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.minimized-actions {
    display: flex;
    gap: 10px;
}

.minimized-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.minimized-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.minimized-btn.expand:hover {
    background: #3699ff;
}

.minimized-btn.close:hover {
    background: #f64e60;
}

/* Main Interface */
.interface-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    grid-template-rows: auto 1fr;
    width: 100%;
    height: 100%;
    gap: 0;
}

.interface-header {
    grid-column: 1 / -1;
    background: #1b1b28;
    border-bottom: 1px solid #2d2d43;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.call-status-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid #10b981;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
}

.call-status-badge.ringing {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%,
    100% {
        border-color: #f59e0b;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    50% {
        border-color: #fbbf24;
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

.status-dot-animated {
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

.status-dot-animated.ringing {
    background: #f59e0b;
}

@keyframes pulse-dot {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

.status-text {
    color: #10b981;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-text.ringing {
    color: #f59e0b;
}

.header-center {
    flex: 1;
    text-align: center;
    color: #9296a5;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #2d2d43;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.icon-btn.minimize:hover {
    background: #3699ff;
}

.icon-btn.close:hover {
    background: #f64e60;
    border-color: #f64e60;
}

/* Left Panel - Caller Info */
.caller-panel {
    background: #1b1b28;
    border-right: 1px solid #2d2d43;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.caller-identity {
    padding: 2.5rem 2rem;
    background: linear-gradient(
        135deg,
        rgba(54, 153, 255, 0.2) 0%,
        rgba(137, 80, 252, 0.2) 100%
    );
    border-bottom: 1px solid #2d2d43;
}

.caller-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3699ff 0%, #8950fc 100%);
    border: 4px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 60px rgba(54, 153, 255, 0.4);
}

.caller-name-lg {
    text-align: center;
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.caller-phone-lg {
    text-align: center;
    color: #9296a5;
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.caller-badges-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.badge-pill {
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.badge-pill.success {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    color: #10b981;
}

.badge-pill.warning {
    background: rgba(245, 158, 11, 0.25);
    border-color: #f59e0b;
    color: #f59e0b;
}

.badge-pill.info {
    background: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Quick Stats Cards */
.quick-stats {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: #1e1e2d;
    border: 1px solid #2d2d43;
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: #252538;
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #9296a5;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Action Buttons */
.action-buttons {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.action-card {
    background: #1e1e2d;
    border: 1px solid #2d2d43;
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.action-card:hover {
    background: #252538;
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3699ff 0%, #8950fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-label {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
}

/* Right Panel - Content */
.content-panel {
    background: #1e1e2d;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 0;
    padding: 2rem 2rem 0;
    border-bottom: 2px solid #2d2d43;
}

.tab-btn {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    color: #9296a5;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    color: white;
    border-bottom-color: #3699ff;
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3699ff, #8950fc);
    border-radius: 3px 3px 0 0;
}

/* Tab Content Area */
.tab-content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Customer Details Card */
.detail-card {
    background: #1b1b28;
    border: 1px solid #2d2d43;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #2d2d43;
}

.detail-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3699ff 0%, #8950fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-card-title {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    gap: 1.25rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #2d2d43;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #9296a5;
    font-weight: 500;
    font-size: 0.95rem;
}

.detail-value {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-align: right;
}

/* Contacts List */
.contacts-list {
    display: grid;
    gap: 1rem;
}

.contact-item {
    background: #1b1b28;
    border: 1px solid #2d2d43;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.contact-item:hover {
    background: #252538;
    transform: translateX(5px);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.contact-name {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.contact-primary {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.contact-details {
    display: grid;
    gap: 0.5rem;
    color: #9296a5;
    font-size: 0.9rem;
}

/* Tickets Table */
.tickets-table {
    display: grid;
    gap: 1rem;
}

.ticket-row {
    background: #1b1b28;
    border: 1px solid #2d2d43;
    border-left: 4px solid;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.ticket-row:hover {
    background: #252538;
    transform: translateX(5px);
}

.ticket-row.urgent {
    border-left-color: #f64e60;
}
.ticket-row.high {
    border-left-color: #f59e0b;
}
.ticket-row.medium {
    border-left-color: #3699ff;
}
.ticket-row.low {
    border-left-color: #10b981;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.ticket-number {
    color: #8950fc;
    font-weight: 700;
    font-size: 1rem;
}

.ticket-status {
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ticket-status.open {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.ticket-status.waiting_customer {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.ticket-title {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    color: #9296a5;
    font-size: 0.85rem;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #3699ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #9296a5;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.empty-text {
    color: #9296a5;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Scrollbar Styling */
.caller-panel::-webkit-scrollbar,
.content-panel::-webkit-scrollbar,
.tab-content-area::-webkit-scrollbar {
    width: 8px;
}

.caller-panel::-webkit-scrollbar-track,
.content-panel::-webkit-scrollbar-track,
.tab-content-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.caller-panel::-webkit-scrollbar-thumb,
.content-panel::-webkit-scrollbar-thumb,
.tab-content-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.caller-panel::-webkit-scrollbar-thumb:hover,
.content-panel::-webkit-scrollbar-thumb:hover,
.tab-content-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Z-index Fix */
.modal {
    z-index: 10050 !important;
}

.modal-backdrop {
    z-index: 10049 !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .interface-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    .caller-panel {
        border-right: none;
        border-bottom: 1px solid #2d2d43;
    }

    .quick-stats,
    .action-buttons {
        grid-template-columns: repeat(4, 1fr);
    }

    .caller-interface.answered {
        width: 100%;
        height: 60%;
        bottom: 0;
        top: auto;
    }
}

/* Ringing state - smaller interface */
.caller-interface.ringing {
    width: 500px;
    height: 500px !important;
    top: 20px;
    right: 20px;
    left: auto;
    bottom: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: pulse-ringing 1.5s infinite;
}

/* Full screen when answered */
.caller-interface.answered {
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    border-radius: 0;
}

/* Fix for minimized view expansion */
.caller-interface.minimized .interface-grid {
    display: none !important;
}

.caller-interface:not(.minimized) .interface-grid {
    display: grid !important;
}

/* Ringing interface specific layout */
.caller-interface.ringing .interface-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: 100%;
}

.caller-interface.ringing .caller-panel,
.caller-interface.ringing .content-panel {
    display: none;
}

.caller-interface.ringing .interface-header {
    grid-column: 1;
}

/* Ringing content */
.ringing-content {
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.ringing-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3699ff 0%, #8950fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.ringing-name {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.ringing-phone {
    color: #9296a5;
    font-size: 1.1rem;
}

.ringing-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Ensure minimized view works properly */
.caller-interface.minimized {
    width: 380px;
    height: 120px;
}

.caller-interface.minimized .minimized-view {
    display: flex;
    width: 100%;
    height: 100%;
}

.caller-interface:not(.minimized) .minimized-view {
    display: none;
}
.caller-interface.minimized #ringingContent {
    display: none !important;
}

/* Make sure answered calls in minimized view show proper status */
.caller-interface.minimized .status-dot {
    background: #10B981;
}

.caller-interface.minimized.ringing .status-dot {
    background: #F59E0B;
    animation: blink 1.5s infinite;
}
