* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%);
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.1) 2px,
            rgba(255, 255, 255, 0.1) 4px
        );
    pointer-events: none;
    z-index: -1;
}

.app-header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(33, 150, 243, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.emergency-btn {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.emergency-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.6);
}

.app-main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

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

.quick-actions {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quick-actions h2 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.3rem;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.action-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.action-btn i {
    font-size: 1.5rem;
}

.action-btn.emergency-call {
    border-color: #F44336;
    color: #F44336;
}

.action-btn.emergency-call:hover {
    background: #F44336;
    color: white;
}

.action-btn.share-location {
    border-color: #2196F3;
    color: #2196F3;
}

.action-btn.share-location:hover {
    background: #2196F3;
    color: white;
}

.action-btn.discrete-alert {
    border-color: #9C27B0;
    color: #9C27B0;
}

.action-btn.discrete-alert:hover {
    background: #9C27B0;
    color: white;
}

.action-btn.safe-arrival {
    border-color: #4CAF50;
    color: #4CAF50;
}

.action-btn.safe-arrival:hover {
    background: #4CAF50;
    color: white;
}

.status-panel {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-panel h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.status-info p {
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.95rem;
}

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

.contacts-header h2 {
    color: #333;
    font-size: 1.3rem;
}

.add-btn {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.contacts-list {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 200px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #999;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-subtitle {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.contact-item:hover {
    background-color: #f8f8f8;
}

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

.contact-info h4 {
    color: #333;
    margin-bottom: 0.3rem;
}

.contact-info p {
    color: #666;
    font-size: 0.9rem;
}

.contact-actions {
    display: flex;
    gap: 0.5rem;
}

.contact-actions button {
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.call-btn {
    background: #4CAF50;
    color: white;
}

.call-btn:hover {
    background: #45a049;
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.edit-btn:hover {
    background: #1976D2;
}

.delete-btn {
    background: #F44336;
    color: white;
}

.delete-btn:hover {
    background: #D32F2F;
}

.contact-form {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-form h3 {
    margin-bottom: 1rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2196F3;
}

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

.form-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-actions button[type="submit"] {
    background: #4CAF50;
    color: white;
}

.form-actions button[type="submit"]:hover {
    background: #45a049;
}

.form-actions button[type="button"] {
    background: #f5f5f5;
    color: #333;
}

.form-actions button[type="button"]:hover {
    background: #e0e0e0;
}

.location-info {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 8px;
    color: #666;
}

.location-status.active {
    background: #e8f5e8;
    color: #2e7d32;
}

.location-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.share-options {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.share-options h3 {
    margin-bottom: 1rem;
    color: #333;
}

.share-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    color: #333;
}

.share-btn:hover:not(:disabled) {
    border-color: #2196F3;
    color: #2196F3;
}

.share-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.location-history,
.alert-history {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.location-history h3,
.alert-history h3 {
    margin-bottom: 1rem;
    color: #333;
}

.history-list {
    min-height: 150px;
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.history-info h4 {
    color: #333;
    margin-bottom: 0.3rem;
}

.history-info p {
    color: #666;
    font-size: 0.9rem;
}

.history-time {
    color: #999;
    font-size: 0.8rem;
}

.alert-types {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.alert-option {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.alert-option h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.alert-option p {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.alert-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.alert-btn.emergency {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    color: white;
}

.alert-btn.emergency:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.alert-btn.discrete {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: white;
}

.alert-btn.discrete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

.alert-btn.safe {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: white;
}

.alert-btn.safe:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.settings-group {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-group h3 {
    margin-bottom: 1rem;
    color: #333;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

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

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

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.danger-btn {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.faq-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.faq-section h2 {
    margin-bottom: 1rem;
    color: #333;
}

.faq-item {
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 1rem;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 0;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: #2196F3;
}

.faq-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1rem 0;
    color: #666;
    line-height: 1.6;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e0e0e0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.nav-item.active {
    color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
}

.nav-item:hover {
    color: #2196F3;
}

footer {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-size: 0.8rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    margin-top: 2rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 50% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    transform: translateY(-50%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #333;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: #666;
    line-height: 1.5;
}

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

.modal-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm {
    background: #F44336;
    color: white;
}

.btn-confirm:hover {
    background: #D32F2F;
}

.btn-cancel {
    background: #f5f5f5;
    color: #333;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #4CAF50;
}

.toast.error {
    background: #F44336;
}

.toast.warning {
    background: #FFC107;
    color: #333;
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 40% auto;
        width: 95%;
        padding: 1.5rem;
    }
    
    .contacts-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    .app-main {
        padding: 2rem;
    }
    
    .action-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .alert-types {
        flex-direction: row;
    }
    
    .bottom-nav {
        max-width: 800px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 15px 15px 0 0;
    }
}
