* {
    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;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.6s ease-in;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    position: relative;
}

header h1 {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

header p {
    font-size: 16px;
    color: #666;
}

.admin-link {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 24px;
    text-decoration: none;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: rotate(90deg);
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-back {
    font-size: 20px;
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: rgba(102, 126, 234, 0.2);
}

.btn-logout {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #c82333;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    max-width: 400px;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
}

.login-title {
    text-align: center;
    font-size: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.back-link {
    text-align: center;
    margin-top: 10px;
}

.back-link a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.back-link a:hover {
    color: #667eea;
}

/* Página Pública - Grid de Links */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    justify-items: center;
}

.link-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.link-card-wrapper {
    text-decoration: none;
    display: block;
}

.link-icon-container {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background: #f8f9fa;
    overflow: hidden;
}

.link-icon-public {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    object-fit: contain;
    transition: all 0.3s ease;
}

.hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.link-card:hover .hover-overlay {
    opacity: 1;
}

.link-card:hover .link-icon-public {
    transform: translate(-50%, -50%) scale(1.1);
}

.hover-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.link-card-info {
    padding: 20px;
    text-align: center;
}

.link-card-info h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

/* Formulário Admin */
.form-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
}

.form-section h2 {
    font-size: 24px;
    color: #764ba2;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Lista de Links Admin */
.links-section {
    margin-top: 40px;
}

.links-section h2 {
    font-size: 24px;
    color: #764ba2;
    margin-bottom: 20px;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.link-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.link-info-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.link-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 8px;
}

.link-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

.link-name {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.link-url {
    font-size: 14px;
    color: #667eea;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-url:hover {
    text-decoration: underline;
}

.link-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #fff3cd;
}

.btn-edit:hover {
    background: #ffc107;
    transform: scale(1.1);
}

.btn-delete {
    background: #f8d7da;
}

.btn-delete:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Estados */
.loading, .empty, .error {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.error {
    color: #dc3545;
}

footer {
    text-align: center;
    padding-top: 30px;
    margin-top: 40px;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
}

footer p {
    font-size: 14px;
    color: #777;
}

/* Responsivo */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 32px;
    }

    .form-section {
        padding: 20px;
    }

    .link-item {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .link-info-group {
        width: 100%;
    }

    .link-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }

    .admin-link {
        position: relative;
        margin: 10px auto 0;
    }

    .header-actions {
        position: relative;
        margin: 15px auto 0;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 28px;
    }

    .form-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .link-url {
        font-size: 12px;
    }

    .links-grid {
        grid-template-columns: 1fr;
    }
}