/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-size: 1.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: #e74c3c;
    color: white;
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #2ecc71;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Sections */
.section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 0.5rem;
}

/* Checkbox Lists */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.checkbox-item:hover {
    background-color: #f8f9fa;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Events List */
.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.event-card {
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    background: white;
    transition: all 0.3s ease;
}

.event-card:hover {
    border-color: #e74c3c;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.event-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.event-meta {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Ambulance Tracking */
.ambulance-tracking {
    display: grid;
    gap: 20px;
}

.ambulance-item {
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    background: white;
}

.ambulance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ambulance-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.current-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-available {
    background: #d4edda;
    color: #155724;
}

.status-on-the-road {
    background: #fff3cd;
    color: #856404;
}

.status-on-place {
    background: #cce5ff;
    color: #004085;
}

.status-charging {
    background: #f8d7da;
    color: #721c24;
}

.status-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.status-btn {
    padding: 10px 15px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.status-btn.active {
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.status-btn .timestamp {
    display: block;
    font-size: 0.8rem;
    font-weight: normal;
    margin-top: 4px;
    opacity: 0.8;
}

/* Resource Lists */
.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.resource-item {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 1rem;
    background: #f8f9fa;
}

.resource-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.resource-item p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
}

/* Users List */
.users-list {
    margin-top: 2rem;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.user-info-item {
    display: flex;
    flex-direction: column;
}

.user-role {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #e8f4f8;
    color: #2980b9;
}

.role-operator {
    background: #f0f9e8;
    color: #27ae60;
}

/* Logs */
.logs-controls {
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
}

.logs-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th,
.logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.logs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
}

.logs-table tr:hover {
    background: #f8f9fa;
}

.log-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.log-setup {
    background: #e8f4f8;
    color: #2980b9;
}

.log-status_change {
    background: #fff3cd;
    color: #856404;
}

/* Messages */
.message-box {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
    word-wrap: break-word;
}

.message-box.show {
    transform: translateX(0);
}

.message-box.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.error-message {
    color: #e74c3c;
    margin-top: 1rem;
    padding: 10px;
    border-radius: 6px;
    background: #fdf2f2;
    border: 1px solid #f8d7da;
    display: none;
}

.error-message.show {
    display: block;
}

.help-text {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.help-text p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.help-text strong {
    color: #2c3e50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .container {
        padding: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .events-list,
    .resource-list {
        grid-template-columns: 1fr;
    }

    .status-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .ambulance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logs-table {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .status-buttons {
        grid-template-columns: 1fr;
    }

    .login-box {
        margin: 20px;
        padding: 2rem;
    }

    .section {
        padding: 1.5rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }
}