/* Custom styles beyond Tailwind */

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #10b981;
    transition: 0.3s;
    border-radius: 30px;
}

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

input:checked + .toggle-slider {
    background-color: #ef4444;
}

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

/* Status indicator */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: #10b981;
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Alert card */
.alert-card {
    border-left: 4px solid #ef4444;
}

.alert-card.acknowledged {
    border-left-color: #9ca3af;
    opacity: 0.7;
}

/* Map container */
#map {
    height: 300px;
    border-radius: 8px;
    z-index: 0;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

/* Small toggle switch for settings */
.toggle-switch-small {
    position: relative;
    width: 40px;
    height: 20px;
    display: inline-block;
}

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

.toggle-slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 20px;
}

.toggle-slider-small:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider-small {
    background-color: #3b82f6;
}

input:checked + .toggle-slider-small:before {
    transform: translateX(20px);
}

/* Screenshot thumbnail */
.screenshot-thumb {
    aspect-ratio: 9/16;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.screenshot-thumb:hover {
    transform: scale(1.05);
}

.screenshot-item {
    position: relative;
}

.screenshot-item .screenshot-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 2px;
    border-radius: 0 0 4px 4px;
}

/* Device selector dropdown */
#device-selector-arrow.open {
    transform: rotate(180deg);
}

/* Device list item */
.device-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.device-list-item:hover {
    background-color: #f3f4f6;
}

.device-list-item.selected {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.device-list-item .device-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.device-list-item .device-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-list-item .device-status {
    font-size: 0.75rem;
    color: #6b7280;
}

/* SMS Conversations */
.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s;
}

.conversation-item:hover {
    background-color: #f9fafb;
}

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

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-name {
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.conversation-preview {
    font-size: 14px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.conversation-badge .message-count {
    background-color: #e5e7eb;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* SMS Messages */
#sms-messages-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
}

.message-bubble.received {
    align-self: flex-start;
    background-color: #f3f4f6;
    border-bottom-left-radius: 4px;
}

.message-bubble.sent {
    align-self: flex-end;
    background-color: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-text {
    margin: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
}

.message-bubble.sent .message-time {
    text-align: right;
}

/* Conversation header */
.conversation-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    background-color: #f9fafb;
}

.conversation-header-bar .back-btn {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
    border: none;
    background: none;
    font-size: 18px;
}

.conversation-header-bar .back-btn:hover {
    background-color: #e5e7eb;
}
