/* ========================================
   SMS Forwarder Panel - Custom Styles
   ======================================== */

/* Base Styles */
:root {
    --primary-color: #1976D2;
    --primary-dark: #1565C0;
    --primary-light: #42A5F5;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --info-color: #2196F3;
    --dark-color: #212121;
    --light-color: #FAFAFA;
    --text-muted: #757575;
    --border-color: #E0E0E0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-light {
    background-color: var(--light-color) !important;
}

/* Navbar Styles */
.navbar {
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.navbar-brand i {
    font-size: 1.5rem;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* Device List Styles */
#devicesList {
    max-height: 500px;
    overflow-y: auto;
}

.device-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.device-item:hover {
    background-color: #f8f9fa;
}

.device-item:last-child {
    border-bottom: none;
}

.device-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid var(--primary-color);
}

.device-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.device-status {
    font-size: 0.85rem;
}

.device-status .online {
    color: var(--success-color);
}

.device-status .offline {
    color: var(--text-muted);
}

.device-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.device-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.device-item:hover .device-actions {
    opacity: 1;
}

/* Messages Container */
.messages-container {
    max-height: 600px;
    overflow-y: auto;
}

.message-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.message-item:hover {
    background-color: #f8f9fa;
}

.message-item:last-child {
    border-bottom: none;
}

.message-sender {
    font-weight: 600;
    color: var(--primary-color);
}

.message-body {
    color: var(--dark-color);
    margin: 8px 0;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.message-device {
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 8px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--dark-color);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Badge Styles */
.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
}

/* Form Styles */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 6px;
}

/* Modal Styles */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* Toast Styles */
.toast-container {
    z-index: 9999;
}

.toast {
    border-radius: 8px;
}

/* Empty States */
#noDevices,
#noMessages {
    padding: 40px 20px;
}

#noDevices i,
#noMessages i {
    color: var(--border-color);
}

/* Footer */
footer {
    margin-top: auto;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    #devicesList,
    .messages-container {
        max-height: 300px;
    }
    
    .device-actions {
        opacity: 1;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-item.new {
    animation: slideIn 0.3s ease-out;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status-dot.offline {
    background-color: var(--text-muted);
}

/* Action buttons in device card */
.device-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.device-card-actions .btn {
    flex: 1;
    font-size: 0.85rem;
}

/* Device detail card */
.device-detail-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.device-detail-card h6 {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.device-detail-card p {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 0;
}

/* Time ago styling */
.time-ago {
    font-size: 0.75rem;
    color: var(--text-muted);
}
