/* Base Styles */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f4f7f6; 
    padding: 20px;
    margin: 0;
}

.container { 
    max-width: 800px; 
    margin: auto; 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}

h2, h3 { 
    color: #333;
    word-wrap: break-word;
}

/* Form Styles */
.form-group { 
    margin-bottom: 15px; 
}

label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold;
    font-size: 14px;
}

input[type="text"], 
input[type="tel"],
input[type="password"] { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    box-sizing: border-box;
    font-size: 16px; /* Prevents zoom on iOS */
}

.checkbox-group { 
    display: flex; 
    align-items: center; 
    gap: 10px;
    flex-wrap: wrap;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Button Styles */
.btn-save { 
    background: #28a745; 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 4px; 
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.btn-save:hover {
    background: #218838;
}

.btn-edit { 
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.btn-edit:hover {
    text-decoration: underline;
}

.btn-delete { 
    color: #dc3545; 
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.btn-delete:hover {
    text-decoration: underline;
}

.btn-cancel { 
    color: #666; 
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: inline-block;
    font-size: 14px;
}

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

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    -webkit-overflow-scrolling: touch;
}

table { 
    width: 100%; 
    border-collapse: collapse;
}

th, td { 
    text-align: left; 
    padding: 12px; 
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.badge { 
    padding: 4px 8px; 
    border-radius: 12px; 
    font-size: 0.8em; 
    color: white;
    white-space: nowrap;
    display: inline-block;
}

.active { 
    background: #28a745; 
}

.inactive { 
    background: #6c757d; 
}

/* Mobile Card View */
.mobile-cards {
    display: none;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

.user-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.user-card-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    word-break: break-word;
    flex: 1;
}

.user-card-body {
    margin-bottom: 15px;
}

.user-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    gap: 10px;
}

.user-info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

.info-value {
    color: #333;
    text-align: right;
    font-size: 14px;
    word-break: break-word;
    flex: 1;
}

.user-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.user-card-actions .btn-edit,
.user-card-actions .btn-delete {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.user-card-actions .btn-edit {
    background: #007bff;
    color: white;
}

.user-card-actions .btn-edit:hover {
    background: #0056b3;
}

.user-card-actions .btn-delete {
    background: #dc3545;
    color: white;
}

.user-card-actions .btn-delete:hover {
    background: #c82333;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Layout Utilities */
.centered-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f4f7f6;
    padding: 20px;
    box-sizing: border-box;
}

.login-card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

/* Forbidden Page Styles */
.forbidden-bg {
    background-color: #f8d7da;
}

.error-text {
    color: #721c24;
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Button Helpers */
.btn-full {
    width: 100%;
}

.btn-block {
    display: inline-block;
    text-decoration: none;
    margin-top: 15px;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

hr {
    margin: 30px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Responsive Breakpoints */

/* Tablets and below (768px) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-flex .btn-delete {
        align-self: flex-end;
    }
    
    /* Hide table, show cards */
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn-save,
    .form-actions .btn-cancel {
        width: 100%;
        text-align: center;
    }
}

/* Mobile devices (480px) */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 15px;
        border-radius: 4px;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .error-text {
        font-size: 1.5rem;
    }
    
    input[type="text"], 
    input[type="tel"],
    input[type="password"] {
        padding: 12px;
    }
    
    .btn-save,
    .btn-cancel {
        padding: 12px 16px;
    }
    
    .badge {
        font-size: 0.75em;
        padding: 3px 6px;
    }
    
    .user-card {
        padding: 12px;
    }
    
    .user-card-header h4 {
        font-size: 1rem;
    }
    
    .info-label,
    .info-value {
        font-size: 13px;
    }
    
    .user-card-actions {
        flex-direction: column;
    }
    
    .user-card-actions .btn-edit,
    .user-card-actions .btn-delete {
        width: 90%;
        text-align: center;
    }
}

/* Extra small devices (360px) */
@media (max-width: 360px) {
    .container {
        padding: 10px;
    }
    
    h2 {
        font-size: 1.1rem;
    }
    
    .btn-save,
    .btn-cancel {
        font-size: 13px;
    }
    
    .user-card {
        padding: 10px;
    }
    
    .user-card-header h4 {
        font-size: 0.95rem;
    }
}