body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    text-align: center; /* Added from index.php inline style */
}
h1, h2 {
    color: #0056b3;
    margin-bottom: 10px;
}
p {
    margin-bottom: 15px;
}
a {
    color: #1a1f4a; /* Corporate secondary color - dark blue */
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: #0f1230; /* Darker shade for hover */
    text-decoration: underline;
}
button, input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}
button:hover, input[type="submit"]:hover {
    background-color: #0056b3;
}
form {
    margin-bottom: 30px;
    /* Removed width and max-width from general form rule */
    text-align: left; /* Align form content to left */
}
form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
form input[type="text"],
form input[type="password"],
form select {
    width: calc(100% - 22px); /* Adjust width considering padding and border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}
form input[type="submit"] {
    width: 100%; /* Make submit button full width */
    margin-top: 5px;
}

/* Style for the logo image */
.site-logo {
    max-width: 200px; /* Adjust size as needed */
    height: auto;
    margin-bottom: 20px; /* Space below the logo */
}


/* --- General Container Styling --- */
.container {
    width: 95%; /* Make it a bit wider for manage_users and dashboard */
    max-width: 900px; /* Max width for larger screens */
    margin: 20px auto; /* Center the container and add vertical margin */
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Softer shadow */
}

/* Specific container for forms (like edit_user) */
.form-container {
    width: 100%; /* Adjust width as needed */
    max-width: 500px; /* Max width for larger screens */
    margin: 20px auto; /* Center the container */
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Softer shadow */
}

/* Apply width/max-width specifically to forms within form-container */
.form-container form {
    width: 100%;
    max-width: 400px; /* Apply the narrow width here */
    margin: 0 auto; /* Center the form within its container */
}


/* --- General Heading Styling --- */
/* Note: h2 style is also defined above, the last one will apply */
/* Keeping this here for clarity of the block I provided earlier */
h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
}

/* --- Form Group Styling --- */
.form-group {
    margin-bottom: 20px; /* Increased spacing */
}

.form-group label {
    display: block;
    margin-bottom: 8px; /* Increased spacing */
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px; /* Increased padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s ease; /* Smooth transition on focus */
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
    border-color: #007bff; /* Highlight on focus */
    outline: none; /* Remove default outline */
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25); /* Subtle shadow on focus */
}

.form-group .help-block {
    color: #dc3545; /* Red color for errors */
    font-size: 0.85em; /* Slightly smaller font */
    margin-top: 5px;
    display: block; /* Ensure it's on its own line */
}

/* --- Form Actions Styling --- */
.form-actions {
    text-align: center;
    margin-top: 30px; /* Increased spacing */
}

.form-actions input[type="submit"],
.form-actions a.button { /* Use a class for links styled as buttons */
    padding: 12px 25px; /* Increased padding */
    font-size: 1em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none; /* Remove underline from links */
    display: inline-block; /* Allow margin between buttons */
    margin: 0 10px; /* Add horizontal margin */
    transition: background-color 0.3s ease; /* Smooth transition */
}

.form-actions input[type="submit"] {
    background-color: #28a745; /* Green for submit */
    color: white;
}

.form-actions input[type="submit"]:hover {
    background-color: #218838; /* Darker green on hover */
}

.form-actions a.button {
    background-color: #6c757d; /* Gray for cancel */
    color: white;
}

.form-actions a.button:hover {
    background-color: #5a6268; /* Darker gray on hover */
}

/* --- Separator Style --- */
.form-container hr {
    margin: 25px 0; /* Spacing around the separator */
    border: 0;
    border-top: 1px solid #eee;
}

/* --- Password Hint Style --- */
.password-hint {
    font-size: 0.9em;
    color: #777;
    text-align: center;
    margin-bottom: 20px;
}


/* --- Enhanced Alert Messages with animations --- */
.alert {
    padding: 18px 20px;
    margin: 20px auto;
    max-width: 600px;
    border: none;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 1em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.5s ease-out;
    transition: all 0.3s ease;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0.3) 100%);
}

.alert:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.alert-success {
    color: #0f5132;
    background: linear-gradient(135deg, #d1e7dd 0%, #a3cfbb 100%);
    border-left: 5px solid #198754;
}

.alert-success::before {
    background: linear-gradient(90deg, #198754 0%, #20c997 50%, #198754 100%);
}

.alert-error {
    color: #842029;
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border-left: 5px solid #dc3545;
}

.alert-error::before {
    background: linear-gradient(90deg, #dc3545 0%, #fd7e14 50%, #dc3545 100%);
}

/* Animation keyframes */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Auto-hide animation for alerts */
.alert.auto-hide {
    animation: slideInDown 0.5s ease-out, fadeOut 0.5s ease-in 4s forwards;
}

/* --- Styles for manage_users.php table --- */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.user-table th,
.user-table td {
    border: 1px solid #ddd;
    padding: 12px; /* Increased padding */
    text-align: left;
    font-size: 0.95em;
}

.user-table th {
    background-color: #007bff; /* Blue header */
    color: white;
    font-weight: bold;
}

.user-table tr:nth-child(even) {
    background-color: #f2f2f2; /* Lighter gray for even rows */
}

.user-table tr:hover {
    background-color: #e9e9e9; /* Highlight row on hover */
}

.user-table .actions a {
    margin-right: 10px;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.user-table .actions .edit-btn {
    color: #ffc107; /* Yellow */
    border: 1px solid #ffc107;
}
.user-table .actions .edit-btn:hover {
      background-color: #ffc107;
      color: white;
}


.user-table .actions .delete-btn {
    color: #dc3545; /* Red */
      border: 1px solid #dc3545;
}
.user-table .actions .delete-btn:hover {
      background-color: #dc3545;
      color: white;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #777;
    background-color: #fff;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.add-user-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #28a745; /* Green button */
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}
.add-user-link:hover {
    background-color: #218838; /* Darker green */
}

.back-link {
    display: block;
    margin-top: 20px;
    text-align: center;
    color: #1a1f4a; /* Corporate secondary color - dark blue */
    text-decoration: none;
    font-weight: bold;
}
.back-link:hover {
    color: #0f1230; /* Darker shade for hover */
    text-decoration: underline;
}

/* Styles moved from index.php inline block */
.form-section {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    margin-top: 20px;
    border-radius: 8px;
    display: inline-block; /* Or width: 50%; margin: auto; for centered block */
    text-align: left;
}
.form-section h2 {
    text-align: center;
    margin-top: 0;
}
.form-section input[type="text"],
.form-section input[type="password"],
.form-section select,
.form-section input[type="file"] {
    width: calc(100% - 22px); /* Adjust for padding/border */
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.form-section label {
    display: block;
    margin-bottom: 5px;
}
hr { /* General hr rule, specific .form-container hr will override where applicable */
    margin-top: 30px;
    margin-bottom: 30px;
    border: 0;
    border-top: 1px solid #eee;
}

/* Styles for buttons/links from index.php inline block */
.btn {
    display: inline-block; /* Make links behave like block elements for padding/margin */
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    text-decoration: none; /* Remove underline */
    text-align: center;
    margin: 5px; /* Add some margin around buttons */
    transition: background-color 0.3s ease; /* Smooth transition on hover */
}

.btn-primary {
    background-color: #1a1f4a; /* Corporate secondary color - dark blue */
    color: white;
    border-color: #1a1f4a;
}
.btn-primary:hover {
    background-color: #0f1230; /* Darker shade for hover */
    border-color: #0f1230;
}

.btn-danger {
    background-color:rgb(255, 0, 0); /* Red */
    color: white;
}
.btn-danger:hover {
    background-color:rgb(255, 102, 0);
}

.btn-secondary {
    background-color: #1a1f4a; /* Corporate secondary color - dark blue */
    color: white;
    border-color: #1a1f4a;
}
.btn-secondary:hover {
    background-color: #0f1230; /* Darker shade for hover */
    border-color: #0f1230;
    color: white; /* Ensure text remains visible on hover */
}

/* Styles for the new admin dashboard cards */
.admin-dashboard {
    margin-top: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.admin-dashboard h3 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 600;
}

.admin-card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.admin-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.admin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.card-header i {
    font-size: 2.5em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.card-header h4 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-content {
    padding: 25px;
    text-align: center;
}

.card-content p {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.5;
}

.btn-card {
    display: inline-block;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 10px 18px;
    margin: 5px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.btn-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    color: white;
    text-decoration: none;
}

.btn-card i {
    margin-right: 8px;
    font-size: 0.9em;
}

/* Styles for the operations table to ensure no horizontal scroll */
.table-responsive {
    overflow-x: auto;
}

.table-responsive table {
    table-layout: fixed; /* Ensures columns respect specified widths */
    width: 100%; /* Table takes 100% of its container's width */
}

.table-responsive th:nth-child(1), /* Column RUT */
.table-responsive td:nth-child(1) {
    width: 15%;
}

.table-responsive th:nth-child(2), /* Column Razón Social */
.table-responsive td:nth-child(2) {
    width: 35%; /* More space for longer names */
}

.table-responsive th:nth-child(3), /* Column Tipo de Instructivo */
.table-responsive td:nth-child(3) {
    width: 25%;
}

.table-responsive th:nth-child(4), /* Column Tipo de Gestión */
.table-responsive td:nth-child(4) {
    width: 15%;
}

.table-responsive th:nth-child(5), /* Column Acciones */
.table-responsive td:nth-child(5) {
    width: 10%; /* Space for the Edit button */
    text-align: center; /* Center the cell content */
}

/* Optional: Ensures long text wraps to multiple lines if necessary */
.table-responsive td {
    word-break: break-word;
}

/* --- Styles for client table (ver_clientes.php) --- */
/* ESTA ES LA SECCIÓN CORREGIDA Y SIMPLIFICADA */
.client-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.client-table th,
.client-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    font-size: 0.95em;
    word-wrap: break-word;
    white-space: normal;
}

.client-table th {
    background-color: #FFA000; /* Corporate primary color - orange */
    color: white;
    font-weight: bold;
}

.client-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.client-table tr:hover {
    background-color: #e9e9e9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 10px; /* Reduce overall padding on smaller screens */
    }

    h1 {
        font-size: 1.8em; /* Adjust heading size */
    }

    h2 {
        font-size: 1.5em; /* Adjust heading size */
    }

    .site-logo {
        max-width: 150px; /* Make logo smaller on mobile */
    }

    .container,
    .form-container {
        width: 100%; /* Take full width on smaller screens */
        padding: 15px; /* Reduce padding inside containers */
        margin: 10px auto; /* Adjust margin */
    }

    .form-section {
        width: 100%; /* Ensure form sections take full width */
        padding: 15px;
        display: block; /* Change from inline-block to block for better mobile layout */
    }

    .btn {
        padding: 8px 15px; /* Slightly smaller buttons */
        font-size: 14px;
        margin: 3px; /* Reduce margin between buttons */
    }

    /* For tables that might overflow */
    .table-responsive {
        overflow-x: auto; /* Enable horizontal scrolling for tables */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    .user-table th,
    .user-table td {
        padding: 8px; /* Reduce table cell padding */
        font-size: 0.85em; /* Smaller font in table */
    }

    /* Responsive styles for admin dashboard */
    .admin-dashboard {
        margin-top: 20px;
        padding: 0 10px;
    }
    
    .admin-dashboard h3 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .admin-card-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .admin-card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px;
    }
    
    .card-header i {
        font-size: 2em;
        margin-bottom: 8px;
    }
    
    .card-header h4 {
        font-size: 1.1em;
    }
    
    .card-content {
        padding: 20px 15px;
    }
    
    .btn-card {
        display: block;
        width: 100%;
        margin: 8px 0;
        padding: 12px;
        font-size: 0.95em;
        text-align: center;
    }
    
    .alert {
        margin: 15px 10px;
        padding: 15px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }
    h2 {
        font-size: 1.3em;
    }
    .site-logo {
        max-width: 120px;
    }
    .btn {
        font-size: 13px;
        padding: 7px 12px;
    }
    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group select {
        padding: 10px; /* Ensure inputs are not too large */
        font-size: 0.9em;
    }
}