* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2em;
}

.login-box h2 {
    text-align: center;
    color: #555;
    margin-bottom: 30px;
    font-size: 1.3em;
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-info {
    background: #4299e1;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 14px;
}

.btn-info:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.btn-edit {
    background: #4299e1;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
}

.btn-edit:hover {
    background: #3182ce;
}

.btn-delete {
    background: #f56565;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
}

.btn-delete:hover {
    background: #e53e3e;
}

.btn-logout {
    background: #718096;
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-logout:hover {
    background: #4a5568;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #f56565;
}

.login-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

.login-info p {
    margin: 5px 0;
}

.login-info code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 4px;
    color: #667eea;
    font-weight: 600;
}

/* Dashboard */
.dashboard-container {
    min-height: 100vh;
    padding: 20px;
}

.dashboard-header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    color: #667eea;
    font-size: 1.8em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.user-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.user-badge.gerencia {
    background: #dbeafe;
    color: #1e40af;
}

.content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.actions-bar {
    margin-bottom: 25px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.tab-link {
    background: #edf2f7;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
}
.tab-link.active {
    background: #667eea;
    color: #fff;
}
.tab-content { }

.table-container {
    overflow-x: auto;
}

.passwords-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.passwords-table thead {
    background: #f7fafc;
}

.passwords-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.passwords-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.passwords-table tbody tr:hover {
    background: #f7fafc;
}

.link-url {
    color: #4299e1;
    text-decoration: none;
    word-break: break-all;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.link-url:hover {
    text-decoration: underline;
}

/* Ensanchar columna URL en escritorio/tablet */
@media (min-width: 769px) {
    .passwords-table th:nth-child(2),
    .passwords-table td:nth-child(2) {
        min-width: 140px;
        width: 140px;
    }
}

.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-value {
    flex: 1;
    min-width: 0;
}

.password-hidden {
    font-size: 18px;
    letter-spacing: 2px;
}

.btn-copy,
.btn-toggle {
    background: #edf2f7;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-copy:hover,
.btn-toggle:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell button {
    margin-right: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.modal-buttons button {
    flex: 1;
}

/* Notification */
.notification {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: slideInRight 0.3s;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #48bb78;
    color: white;
}

.notification.error {
    background: #f56565;
    color: white;
}

.notification.info {
    background: #4299e1;
    color: white;
}

/* Responsive - iPad y tablets */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 15px;
    }
    
    .dashboard-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .dashboard-header h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .user-info {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .content {
        padding: 20px;
    }
    
    .actions-bar {
        margin-bottom: 20px;
    }
    
    .btn-success {
        width: 100%;
    }
}

/* Responsive - Móviles grandes */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .dashboard-header {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 20px;
    }
    
    .dashboard-header h1 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .user-info {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .user-badge {
        text-align: center;
    }
    
    .btn-logout {
        width: 100%;
    }
    
    .content {
        padding: 15px;
    }
    
    .actions-bar {
        margin-bottom: 15px;
    }
    
    .btn-success {
        width: 100%;
        padding: 15px 24px;
        font-size: 15px;
    }
    
    .btn-info {
        display: block;
        width: 100%;
        margin-left: 0;
        margin-bottom: 10px;
        padding: 15px 24px;
        font-size: 15px;
    }
    
    .table-container {
        overflow: visible;
    }
    
    .passwords-table {
        width: 100%;
        font-size: 13px;
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    
    .passwords-table thead {
        display: none;
    }
    
    .passwords-table tr {
        display: block;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
    }
    
    .passwords-table td {
        display: grid;
        grid-template-columns: 120px 1fr;
        padding: 8px 0;
        border: none;
    }
    
    .passwords-table td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        padding-right: 10px;
    }
    
    .copy-field {
        gap: 5px;
    }
    
    .btn-copy,
    .btn-toggle {
        padding: 5px 8px;
        font-size: 14px;
        min-width: 35px;
        min-height: 35px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 8px 12px;
        font-size: 11px;
        margin-bottom: 5px;
        width: 100%;
    }
    
    .actions-cell {
        white-space: normal;
        min-width: 120px;
    }
    
    .actions-cell button {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 14px;
        font-size: 16px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .modal-buttons button:last-child {
        margin-bottom: 0;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .link-url {
        word-break: break-word;
    }
    
    /* Login responsive */
    .login-box {
        padding: 25px;
        max-width: 100%;
    }
    
    .login-box h1 {
        font-size: 1.6em;
    }
    
    .login-box h2 {
        font-size: 1.1em;
    }
    
    .btn-primary {
        padding: 14px;
        font-size: 15px;
    }
}

/* Responsive - Móviles pequeños */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .dashboard-container {
        padding: 8px;
    }
    
    .dashboard-header {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .dashboard-header h1 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .user-badge {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .btn-logout {
        font-size: 12px;
        padding: 10px 16px;
    }
    
    .content {
        padding: 12px;
    }
    
    .btn-success {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .table-container {
        overflow: visible;
        margin-bottom: 10px;
    }
    
    .passwords-table {
        width: 100%;
        font-size: 12px;
        border-collapse: separate;
        border-spacing: 0 10px;
    }
    
    .passwords-table thead {
        display: none;
    }
    
    .passwords-table tr {
        display: block;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 10px;
    }
    
    .passwords-table td {
        display: grid;
        grid-template-columns: 110px 1fr;
        padding: 6px 0;
        border: none;
    }
    
    .passwords-table td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        padding-right: 8px;
        font-size: 12px;
    }
    
    .field-value {
        font-size: 12px;
        min-width: 0;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .copy-field {
        gap: 3px;
    }
    
    .btn-copy,
    .btn-toggle {
        padding: 4px 6px;
        font-size: 12px;
        min-width: 30px;
        min-height: 30px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .password-hidden {
        font-size: 14px;
    }
    
    .modal-content {
        margin: 40% auto 20%;
        width: 98%;
        padding: 15px;
    }
    
    .modal-content h2 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 16px;
    }
    
    .close {
        font-size: 24px;
        padding: 5px;
    }
    
    .notification {
        left: 8px;
        right: 8px;
        top: 8px;
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* Login responsive móvil */
    .login-box {
        padding: 20px;
    }
    
    .login-box h1 {
        font-size: 1.4em;
        margin-bottom: 5px;
    }
    
    .login-box h2 {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    .btn {
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* Optimización para iPad en orientación landscape */
@media (max-height: 600px) {
    .dashboard-header {
        padding: 10px 20px;
    }
    
    .dashboard-header h1 {
        font-size: 1.1em;
    }
    
    .content {
        padding: 15px;
    }
}
