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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 50px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: white;
    font-weight: 500;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 60px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 45px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.3);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease-out;
}

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

.logo-container {
    text-align: center;
    margin-bottom: 25px;
}

.login-logo {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.login-card h2 {
    margin-bottom: 10px;
    color: #333;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.form-control:hover {
    border-color: #667eea;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.code-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: bold;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.form-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.card h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-weight: 600;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.page-header h2 {
    color: #333;
    margin: 0;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Facturas Grid */
.facturas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.factura-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.factura-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.3);
}

.factura-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.factura-info {
    margin: 10px 0;
    color: #666;
}

.factura-info strong {
    color: #333;
    margin-right: 5px;
}

.factura-resta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #eee;
    font-size: 18px;
    font-weight: bold;
    color: #dc3545;
}

/* Factura Info Grid */
.factura-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.factura-info-grid > div {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.factura-info-grid strong {
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.resta-amount {
    color: #dc3545;
    font-weight: bold;
}

/* Contratos */
.contratos-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.contrato-item {
    padding: 12px 20px;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.contrato-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.contrato-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.contrato-item small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

/* Pagos */
.pagos-resumen {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pagos-resumen h4 {
    margin-bottom: 15px;
    color: #333;
}

.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.resumen-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: white;
    border-radius: 4px;
}

.resumen-item.moroso {
    background: #fff3cd;
    color: #856404;
    font-weight: bold;
}

.pagos-list {
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #6c757d;
    color: white;
    font-weight: bold;
}

.table tbody tr:hover {
    background-color: #f5f5f5;
}

.table tbody tr.completo {
    background-color: #d4edda;
}

.table tbody tr.incompleto {
    background-color: #fff3cd;
}

.no-pagos {
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-facturas {
    text-align: center;
    padding: 40px;
    color: #666;
    background: white;
    border-radius: 8px;
}

.error {
    color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header-logo-title {
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .header-logo {
        height: 40px;
        max-width: 120px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .login-card {
        padding: 30px 25px;
        margin: 20px;
        border-radius: 16px;
    }
    
    .login-logo {
        max-width: 100px;
    }
    
    .login-card h2 {
        font-size: 24px;
    }
    
    .facturas-grid {
        grid-template-columns: 1fr;
    }
    
    .factura-info-grid {
        grid-template-columns: 1fr;
    }
    
    .resumen-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

