/* Reset e stili di base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Stili per la pagina principale (index.html) */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.content-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #4f46e5;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.media-container {
    margin: 30px 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shared-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.shared-image:hover {
    transform: scale(1.02);
}

.message {
    background: #f0f9ff;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.message p {
    color: #0c4a6e;
    font-weight: 500;
    font-size: 1.1rem;
}

.location-request {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
}

.location-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.location-request h3 {
    color: #92400e;
    margin-bottom: 10px;
}

.location-request p {
    color: #d97706;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn-secondary:hover {
    background: #4b5563;
}

.error-message, .success-message {
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message {
    background: #fef2f2;
    border: 2px solid #f87171;
    color: #dc2626;
}

.success-message {
    background: #f0fdf4;
    border: 2px solid #4ade80;
    color: #166534;
}

.error-icon, .success-icon {
    font-size: 1.5rem;
}

.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Stili per la pagina admin */
.admin-body {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    min-height: 100vh;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.admin-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: #60a5fa;
}

.stat-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.content-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #60a5fa;
    font-size: 1.5rem;
}

.filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
}

.filter-select option {
    background: #1e293b;
    color: white;
}

.map-container {
    margin-bottom: 30px;
}

.map-placeholder {
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.map-message {
    text-align: center;
}

.map-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.map-coords {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.9rem;
}

.positions-container {
    max-height: 500px;
    overflow-y: auto;
}

.positions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.position-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.position-id {
    font-weight: bold;
    color: #60a5fa;
}

.position-time {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.position-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-label {
    font-weight: 500;
    min-width: 120px;
    font-size: 0.9rem;
}

.detail-value {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.device-info {
    font-family: inherit;
}

.btn-mini {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mini:hover {
    background: #4338ca;
    transform: scale(1.05);
}

.no-data {
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.no-data-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #1e293b;
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #60a5fa;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.generated-link-container {
    display: flex;
    gap: 10px;
}

.link-input {
    flex: 1;
}

.copy-btn {
    white-space: nowrap;
}

/* Schermata di blocco per richiedere posizione */
.location-gate {
    background: linear-gradient(135deg, #f2caca, #fb2424);
    border: 2px solid #f50b0b;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.2);
}

.location-gate .location-icon {
    font-size: 7rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.2);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.2);
    }
    70% {
        transform: scale(1);
    }
}

.location-gate h3 {
    color: #792f00;
    margin-bottom: 15px;
    font-size: 4rem;
    font-weight: 700;
}

.location-gate p {
    color: #b45309;
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.6;
}

.location-gate .btn-primary {
    background: linear-gradient(135deg, #16a34a, #15803d);
    font-size: 1.1rem;
    padding: 15px 30px;
    margin: 20px 0;
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.3);
    border-radius: 12px;
     border: 2px solid #ffffff;
}

.location-gate .btn-primary:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.location-gate .btn-primary span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
}

.security-note {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 12px;
    margin-top: 20px;
}

.security-note small {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
}

.content-hidden {
    display: none;
}

/* Stili per l'autenticazione admin */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.auth-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header h1 {
    color: #4f46e5;
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 700;
}

.auth-header p {
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 1rem;
    line-height: 1.5;
}

.auth-form {
    width: 100%;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.auth-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.auth-input:focus {
    outline: none;
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #fecaca;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .content-card {
        padding: 20px;
    }
    
    .admin-container {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls {
        justify-content: center;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-label {
        min-width: auto;
    }
    
    .generated-link-container {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 2rem;
    }
    
    .position-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .btn-primary, .btn-secondary, .btn-danger {
        width: 100%;
        margin: 5px 0;
    }
}

/* Animazioni */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.position-card {
    animation: fadeIn 0.3s ease;
}

.content-card {
    animation: fadeIn 0.5s ease;
}

/* Scrollbar personalizzata */
.positions-container::-webkit-scrollbar {
    width: 8px;
}

.positions-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.positions-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.positions-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
