.wsr-porteria-app {
	background: white;
	border: 2px solid #0073aa;
	border-radius: 12px;
	padding: 25px;
	max-width: 600px;
	margin: 20px auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	box-shadow: 0 4px 20px rgba(0,0,0,0.08);
	box-sizing: border-box;
}

@media (max-width: 480px) {
	.wsr-porteria-app {
		padding: 14px;
		margin: 8px auto;
		border-radius: 8px;
	}
}

.wsr-porteria-app .wsr-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 15px;
	border-bottom: 2px solid #f0f0f0;
	margin-bottom: 20px;
}

.wsr-porteria-app .wsr-header h2 {
	margin: 0;
	color: #0073aa;
	font-size: 24px;
}

.wsr-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

@media (max-width: 480px) {
	.wsr-porteria-app .wsr-header {
		flex-wrap: wrap;
		gap: 8px;
	}
	.wsr-porteria-app .wsr-header h2 {
		font-size: 18px;
	}
	.wsr-header-right {
		gap: 6px;
	}
	.wsr-clock {
		display: none;
	}
}

.wsr-clock {
	font-size: 18px;
	color: #666;
	font-weight: 300;
}

/* Notificaciones */
.wsr-notif-btn {
	position: relative;
	background: none;
	border: 2px solid #e0e0e0;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 20px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wsr-notif-btn:hover {
	border-color: #0073aa;
	background: #f0f7fd;
}

.wsr-notif-btn.wsr-notif-active {
	border-color: #dc3545;
	background: #fff5f5;
	animation: wsrPulse 2s infinite;
}

.wsr-notif-btn.wsr-ringing {
	border-color: #dc3545;
	background: #fff5f5;
	animation: wsrRinging 0.5s infinite;
}

@keyframes wsrPulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

@keyframes wsrRinging {
	0%, 100% { transform: rotate(0deg); }
	15% { transform: rotate(15deg); }
	30% { transform: rotate(-15deg); }
	45% { transform: rotate(10deg); }
	60% { transform: rotate(-10deg); }
	75% { transform: rotate(5deg); }
}

.wsr-notif-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #dc3545;
	color: white;
	border-radius: 50%;
	width: 20px;
	height: 20px;
	font-size: 11px;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.wsr-notif-panel {
	background: white;
	border: 2px solid #0073aa;
	border-radius: 10px;
	margin-bottom: 15px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.12);
	overflow: hidden;
}

.wsr-notif-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: #f0f7fd;
	border-bottom: 1px solid #e0e0e0;
}

.wsr-notif-close {
	background: none;
	border: none;
	font-size: 18px;
	cursor: pointer;
	color: #666;
	padding: 4px 8px;
	border-radius: 4px;
}

.wsr-notif-close:hover {
	background: #e0e0e0;
}

.wsr-notif-list {
	max-height: 300px;
	overflow-y: auto;
}

.wsr-notif-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	transition: background 0.2s;
}

.wsr-notif-item:hover {
	background: #f0f7fd;
}

.wsr-notif-item:last-child {
	border-bottom: none;
}

.wsr-notif-item-left {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
}

.wsr-notif-icon {
	font-size: 24px;
}

.wsr-notif-item-left div strong {
	display: block;
	color: #333;
	font-size: 14px;
}

.wsr-notif-preview {
	margin: 2px 0 0 0;
	color: #666;
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 200px;
}

.wsr-notif-item-right {
	text-align: right;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

.wsr-notif-count {
	background: #dc3545;
	color: white;
	border-radius: 10px;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: bold;
}

.wsr-notif-item-right small {
	color: #999;
	font-size: 11px;
}

.wsr-notif-empty {
	text-align: center;
	color: #999;
	padding: 20px;
	margin: 0;
}

.wsr-tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 20px;
	flex-wrap: nowrap;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	padding-bottom: 4px;
}

.wsr-tabs::-webkit-scrollbar {
	display: none; /* Chrome/Safari */
}

.wsr-tab {
	flex: 0 0 auto;
	padding: 10px 14px;
	background: #f0f0f0;
	color: #333;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s;
	text-align: center;
	white-space: nowrap;
}

@media (max-width: 480px) {
	.wsr-tab {
		font-size: 12px;
		padding: 9px 10px;
	}
}

.wsr-tab:hover { background: #e0e0e0; }
.wsr-tab.active { background: #0073aa; color: white; }

.wsr-panel { display: none !important; }
.wsr-panel.active { display: block !important; }

.wsr-porteria-app label {
	display: block;
	margin: 12px 0 6px 0;
	color: #333;
	font-weight: 600;
	font-size: 14px;
}

.wsr-porteria-app input[type="text"],
.wsr-porteria-app input[type="number"] {
	width: 100%;
	padding: 12px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	font-size: 15px;
	box-sizing: border-box;
	transition: border-color 0.2s;
}

.wsr-porteria-app input:focus {
	outline: none;
	border-color: #0073aa;
}

.wsr-btn {
	width: 100%;
	padding: 14px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 16px;
	font-weight: bold;
	margin-top: 15px;
	transition: transform 0.1s, box-shadow 0.2s;
}

.wsr-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.wsr-btn:active { transform: translateY(0); }

.wsr-btn-primary { background: #0073aa; color: white; }
.wsr-btn-success { background: #28a745; color: white; }
.wsr-btn-warning { background: #f5991f; color: white; }
.wsr-btn-danger { background: #dc3545; color: white; }

.wsr-result {
	margin-top: 20px;
	padding: 20px;
	border-radius: 8px;
	text-align: center;
	font-weight: bold;
	font-size: 16px;
	animation: wsrFadeIn 0.3s ease-out;
}

@keyframes wsrFadeIn {
	from { opacity: 0; transform: translateY(-10px); }
	to { opacity: 1; transform: translateY(0); }
}

.wsr-result.success {
	background: #d4edda;
	color: #155724;
	border-left: 4px solid #28a745;
}

.wsr-result.error {
	background: #f8d7da;
	color: #721c24;
	border-left: 4px solid #dc3545;
}

.wsr-chat-selector {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
}

.wsr-chat-selector input { flex: 1; padding: 10px; border: 2px solid #e0e0e0; border-radius: 8px; }
.wsr-chat-selector button { width: auto; padding: 10px 20px; margin: 0; }

/* Buscador de residentes */
.wsr-resident-search {
	flex: 1;
	position: relative;
}

.wsr-resident-search input {
	width: 100%;
	padding: 12px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	font-size: 14px;
	box-sizing: border-box;
}

.wsr-resident-search input:focus {
	border-color: #0073aa;
	outline: none;
}

.wsr-resident-list {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: white;
	border: 2px solid #0073aa;
	border-top: none;
	border-radius: 0 0 8px 8px;
	max-height: 250px;
	overflow-y: auto;
	z-index: 100;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wsr-resident-option {
	padding: 10px 14px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
	transition: background 0.15s;
}

.wsr-resident-option:last-child {
	border-bottom: none;
}

.wsr-resident-option:hover {
	background: #f0f7fd;
}

.wsr-resident-option-main {
	font-size: 14px;
	color: #333;
}

.wsr-resident-option-detail {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: #666;
	margin-top: 3px;
}

.wsr-resident-empty {
	padding: 15px;
	text-align: center;
	color: #999;
	font-size: 13px;
}

/* Header del chat con info del residente */
.wsr-chat-header {
	padding: 10px 15px;
	background: #f0f7fd;
	border-bottom: 1px solid #e0e0e0;
	font-size: 13px;
	color: #333;
}

.wsr-chat-box {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	height: 400px;
	display: flex;
	flex-direction: column;
}

@media (max-width: 480px) {
	.wsr-chat-box {
		height: calc(100vh - 280px);
		max-height: 400px;
		min-height: 250px;
	}
}

.wsr-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 15px;
	background: #f9f9f9;
	min-height: 0;
}

.wsr-chat-input {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #e0e0e0;
	background: white;
	flex-shrink: 0;
}

.wsr-chat-input input {
	flex: 1;
	padding: 10px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 16px;
}

.wsr-chat-input button { width: auto; padding: 10px 14px; margin: 0; font-size: 13px; }

@media (max-width: 480px) {
	.wsr-chat-input {
		gap: 5px;
		padding: 8px;
		flex-wrap: wrap;
	}
	.wsr-chat-input input {
		flex: 1 1 100%;
		font-size: 16px;
		padding: 12px 10px;
	}
	.wsr-chat-input button {
		padding: 10px 10px;
		font-size: 12px;
		min-width: 38px;
	}
}

.wsr-chat-footer {
	padding: 8px 10px;
	border-top: 1px solid #f0f0f0;
	text-align: center;
}

/* Respuestas rápidas del portero */
.wsr-quick-responses {
	margin-top: 12px;
	padding: 15px;
	background: #f8f9fa;
	border-radius: 10px;
	border: 2px solid #0073aa;
}

.wsr-quick-responses p {
	margin: 0 0 10px 0;
	font-size: 13px;
	color: #333;
}

.wsr-quick-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wsr-qr-btn {
	padding: 8px 12px;
	border: none;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
}

.wsr-qr-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.wsr-qr-authorize {
	background: #28a745;
	color: white;
}

.wsr-qr-deny {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.wsr-qr-custom {
	background: #fff3cd;
	color: #856404;
	border: 1px solid #ffc107;
}

.wsr-btn-end {
	background: none;
	border: 1px solid #dc3545;
	color: #dc3545;
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	transition: all 0.2s;
}

.wsr-btn-end:hover {
	background: #dc3545;
	color: white;
}

.wsr-chat-msg {
	margin-bottom: 10px;
}

.wsr-chat-msg.mine { text-align: right; }
.wsr-chat-msg.other { text-align: left; }

.wsr-chat-bubble {
	display: inline-block;
	padding: 10px 14px;
	border-radius: 14px;
	max-width: 75%;
	word-wrap: break-word;
	font-size: 14px;
}

.wsr-chat-msg.mine .wsr-chat-bubble {
	background: #0073aa;
	color: white;
	border-bottom-right-radius: 4px;
}

.wsr-chat-msg.other .wsr-chat-bubble {
	background: white;
	color: #333;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
}

.wsr-chat-time {
	display: block;
	font-size: 10px;
	opacity: 0.7;
	margin-top: 4px;
	font-weight: normal;
}

.wsr-footer {
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid #f0f0f0;
	text-align: center;
	color: #666;
}

.wsr-error {
	background: #ffe6e6;
	color: #c00;
	padding: 20px;
	border: 1px solid #c00;
	border-radius: 8px;
	text-align: center;
}


/* Foto de paquete */
.wsr-pkg-video,
.wsr-pkg-preview {
	width: 100%;
	max-width: 250px;
	border-radius: 8px;
	border: 2px solid #e0e0e0;
	margin: 8px 0;
	display: block;
}

.wsr-pkg-foto-btns {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.wsr-btn-foto-pkg {
	padding: 8px 14px;
	border: 1px solid #e0e0e0;
	background: #f8f9fa;
	border-radius: 6px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s;
}

.wsr-btn-foto-pkg:hover {
	background: #e0e0e0;
	border-color: #0073aa;
}


/* ============ BOTÓN DE EMERGENCIA ============ */
.wsr-emergency-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    border: 3px solid #fff;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(211, 47, 47, 0.5);
    z-index: 9990;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wsr-emergency-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(211, 47, 47, 0.7);
}
.wsr-emergency-float-btn.wsr-emergency-btn-active {
    animation: wsrEmergBtnPulse 1s infinite;
}
@keyframes wsrEmergBtnPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(211, 47, 47, 0.5); }
    50% { box-shadow: 0 0 30px rgba(211, 47, 47, 0.9); transform: scale(1.05); }
}

/* Panel de emergencia */
.wsr-emergency-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9991;
    overflow: hidden;
    animation: wsrEmergSlideUp 0.3s ease;
}
@keyframes wsrEmergSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.wsr-emergency-panel-header {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wsr-emergency-panel-header h3 {
    margin: 0;
    font-size: 15px;
    color: white;
}
.wsr-emergency-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
}
.wsr-emergency-close:hover { opacity: 1; }
.wsr-emergency-warning {
    padding: 12px 18px;
    margin: 0;
    background: #fff3e0;
    color: #e65100;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #ffe0b2;
}

/* Botones de tipo de emergencia */
.wsr-emergency-types {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.wsr-emergency-type-btn {
    padding: 14px 10px;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}
.wsr-emergency-type-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.wsr-emergency-type-btn:active {
    transform: scale(0.95);
}

/* Área de mensaje y confirmación */
.wsr-emergency-message-area {
    padding: 16px;
}
.wsr-emergency-message-area textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    resize: none;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.wsr-emergency-confirm-btn {
    width: 100%;
    padding: 14px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.wsr-emergency-confirm-btn:hover { background: #b71c1c; }
.wsr-emergency-cancel-btn {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.wsr-emergency-deactivate-btn {
    padding: 14px 30px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.wsr-emergency-deactivate-btn:hover { background: #388e3c; }

/* Responsive */
@media (max-width: 400px) {
    .wsr-emergency-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 85px;
    }
}
